binutils Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
binutils

Fix the strrchr error for DOS based filesystem

Fixes -Wdiscarded-qualifiers errors when using strrchr with DOS-style paths.

Addresses -Wdiscarded-qualifiers errors in binutils and gprof when using strrchr with DOS-based file systems. The return value of strrchr is now assigned to a const char* to avoid the warning.

In Details

This commit fixes const correctness issues in binutils/bucomm.c and gprof/source.c related to DOS-based file systems. The code now uses const char * for variables that store the result of strrchr to avoid -Wdiscarded-qualifiers warnings.

For Context

On DOS-based file systems, backslashes are used as directory separators. The strrchr function finds the last occurrence of a character in a string. When dealing with filenames, it's important to handle backslashes correctly. This commit makes sure the code is const-correct when using strrchr to find the last backslash in a DOS-style path, avoiding compiler warnings and potential errors.

Filed Under: binutilsgprofDOSconstwarning