Re: [PATCH 1/2] gprof: Fix strchr discarded qualifier call

Project / Subsystem

binutils / gprof

Date

2026-05-02

Proposer

"H.J. Lu" <hjl.tools@gmail.com>

Source type

public_inbox

Consensus

Proposed

Sentiment

/10

Technical tradeoffs

  • Ensures const correctness in gprof, preventing potential issues with string manipulation.
  • No significant performance impact.
  • Improved code maintainability.

All attributes

project
binutils
subsystem
gprof
patch_id
discussion_id
CAMe9rOptBq08_9TMcZE4zdys-LnoQjuhrV0HXvQ_LrnRbCibeA@mail.gmail.com
source_type
public_inbox
title
Re: [PATCH 1/2] gprof: Fix strchr discarded qualifier call
headline
Gprof: Fix strchr discarded qualifier call
tldr
This patch fixes a discarded qualifier call in gprof by ensuring the result of strrchr is stored in a const char *.
proposer
"H.J. Lu" <hjl.tools@gmail.com>
consensus
Proposed
outcome
proposed
sentiment_score
technical_tradeoffs
  • Ensures const correctness in gprof, preventing potential issues with string manipulation.
  • No significant performance impact.
  • Improved code maintainability.
series_id
binutils:gprof: fix strchr discarded qualifier call
series_role
reply
series_parts
  • {"title":"gprof: Fix strchr discarded qualifier call","url":"https://inbox.sourceware.org/binutils/20260502170132.3303884-2-mark@klomp.org"}
tags
  • gprof
  • strrchr
  • const correctness
  • profiling
bugzilla_url
date
2026-05-02T00:00:00.000Z

Re: [PATCH 1/2] gprof: Fix strchr discarded qualifier call

This patch addresses an issue in gprof where the return value of strrchr (which is a const char *) was being assigned to a non-const char *. The patch modifies gprof/source.c to ensure const correctness in the annotate_source function. H.J. Lu suggests combining this patch with another related patch set from Calvin Owens.