On Tue, 4 Apr 2023, Jan Hubicka wrote: > > On Tue, Apr 04, 2023 at 01:21:40AM +0200, Jan Hubicka via Gcc-patches wrote: > > > It is however really side case and I am worried about dropping > > > pure/const from builtin declarations... > > > > Yeah, that can certainly break stuff. See e.g. the recently fixed > > ICE when memcmp wasn't pure in PR109258. > > Yep, i think itis better to poke about this in stage1 (it is a can of > worms). Clearly we have conflict here: if memcmp is implemented locally > one can construct a testcase where profile would be rejected on > -fprofile-use time if const flag is not cleared :(. But it should be > rare thing happening in practice.
If we have a locally implemented memcmp then calls to it shouldn't be marked 'built-in' ... But then when the compiler itself creates a memcmp call it would need to resolve to a not instrumented library copy, or alternatively we should tell the compiler it cannot emit such a call (but for some builtins not being able to emit them might prove interesting). Richard.