https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106912

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
See https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607202.html and the
reaction from Honza.(In reply to Jakub Jelinek from comment #10)
> Also, the other PR is about a function being made const late when it
> previously wasn't, while in this case it is being made non-const after it
> has been const before.
>   /* Drop pure/const flags from instrumented functions.  */
>   if (profile_arc_flag || flag_test_coverage)
>     FOR_EACH_DEFINED_FUNCTION (node)
>       {
>         if (!gimple_has_body_p (node->decl)
>             || !(!node->clone_of
>             || node->decl != node->clone_of->decl))
>           continue;
> 
>         /* Don't profile functions produced for builtin stuff.  */
>         if (DECL_SOURCE_LOCATION (node->decl) == BUILTINS_LOCATION)
>           continue;
> 
>         node->set_const_flag (false, false);
>         node->set_pure_flag (false, false);
>       }
> just looks completely wrong to me for const, which unlike pure attribute can
> be on both function types and on function declarations.  If we want calls to
> const functions to actually not be treated as const when profiling, it can
> be only done by ignoring const everywhere if profile_arc_flag ||
> flag_test_coverage.  It even can't be just ignored for direct calls to
> defined functions, because calls can be indirect at first, without vops, and
> then fndecl propagated and turned into direct.  Or for IPA they can be
> defined in other TUs.

See https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607202.html and the
reaction from Honza.

Reply via email to