https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106912
--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:ed626f18b189920aeed9974aded3f9cb6f25b543 commit r13-6849-ged626f18b189920aeed9974aded3f9cb6f25b543 Author: Richard Biener <rguent...@suse.de> Date: Thu Mar 16 13:51:19 2023 +0100 tree-optimization/106912 - clear const attribute from fntype The following makes sure that after clearing pure/const from instrumented function declarations we are adjusting call statements fntype as well to handle indirect calls and because gimple_call_flags looks at both decl and fntype. Like the pure/const flag clearing on decls we refrain from touching calls to known functions that do not have a body in the current TU. PR tree-optimization/106912 * tree-profile.cc (tree_profiling): Update stmts only when profiling or testing coverage. Make sure to update calls fntype, stripping 'const' there. * gcc.dg/profile-generate-4.c: New testcase.