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

--- Comment #3 from Dima Kogan <gccbugs at dima dot secretsauce.net> ---
Hi. Thanks for replying. I don't the warning that I'm claiming is bogus is
complaining about the points you raised. If it did, then making g() static or
building without -fPIC or -O3 wouldn't make the warning go away.

I have some questions about your analysis, if that's ok. g() doesn't know where
its ab argument came from, so how can the strict aliasing rules be violated?
The only reason the compiler knows anything at all here is that with -O3 it's
tracing the flow. With -O0, there's no warning. And g() may as well be in an
entirely different compilation unit, in which case it'd compile that unit with
no complaint at any optimization level.

Similarly, for the undefined behavior. If I have a function that takes some
double* x, then is it undefined behavior to refer to x[-1]? If not, then how is
this different?

Thanks.

Reply via email to