Strange expl results

Stefan Ring stefanrin@gmail.com
Fri Nov 27 07:54:42 GMT 2020


On Thu, Nov 26, 2020 at 11:46 PM Stefan Ring <stefanrin@gmail.com> wrote:
>
> On Thu, Nov 26, 2020 at 11:27 PM Alex Markin <alexanius@gmail.com> wrote:
> >
> > memset will not help here.
>
> True, but only because it is optimized away! :D

With -O2, the compiler pre-computes both of them at compile time, and
they are both the same (but the upper 6 bytes stay uninitialized, even
with memset).

With -O0, the compiler pre-computes the first one and calls the
library function for the second result, which produces a different
result that differs in the last bit.

Which is slightly surprising, but nothing that I lose sleep over...


More information about the Gcc-help mailing list