[binutils-gdb] gprof: Fix strchr discarded qualifier call

H.J. Lu hjl@sourceware.org
Sun May 3 21:48:18 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b8d39fd810e7373aac4f129c34813f6a609d8d5f

commit b8d39fd810e7373aac4f129c34813f6a609d8d5f
Author: Mark Wielaard <mark@klomp.org>
Date:   Sat May 2 18:56:51 2026 +0200

    gprof: Fix strchr discarded qualifier call
    
    In annotate_source strrchr is called on a const char *. So the result
    should also be stored in a const char *.
    
            * gprof/source.c (annotate_source): Make name_only a const char *.

Diff:
---
 gprof/source.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gprof/source.c b/gprof/source.c
index 860c0b5fec0..4aa7504e8df 100644
--- a/gprof/source.c
+++ b/gprof/source.c
@@ -98,7 +98,8 @@ annotate_source (Source_File *sf, unsigned int max_width,
   bool new_line;
   char buf[8192];
   char *fname;
-  char *annotation, *name_only;
+  char *annotation;
+  const char *name_only;
   FILE *ifp, *ofp;
   Search_List_Elem *sle = src_search_list.head;


More information about the Binutils-cvs mailing list