This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: As-if Rule (was: ARMv8, GCC 4.9 and necessary code optimized away)
- From: Jeffrey Walton <noloader at gmail dot com>
- To: Andrew Haley <aph at redhat dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Wed, 1 Jun 2016 09:32:13 -0400
- Subject: Re: As-if Rule (was: ARMv8, GCC 4.9 and necessary code optimized away)
- Authentication-results: sourceware.org; auth=none
- References: <CAH8yC8k6Ri_fOT4GXpsKnhotCzA_ZUQWvNbFSNU5KdmafNPKmw at mail dot gmail dot com> <574ED5BF dot 1010400 at redhat dot com>
- Reply-to: noloader at gmail dot com
>> I'm not sure I would agree. GCC needs to know intent (q.v.),
>
> No, it does not. It needs to follow the language specification:
> intent is entirely in the head of the programmer, and they'd
> better learn that specification.
>
>> Sorry to sound argumentative. I'm frustrated when a correct program is
>> turned into a misbehaving program :)
>
> It's not a correct program.
Please forgive my ignorance... How, exactly, is it not a correct
program? For the program to be ill-formed, it would have to fall into
one of the many undefined behavior traps. As far as I know, there's no
UB.
And how is removing code and causing a SIGILL maintaining the
observable behavior required by the as-if rule? The program does not
crash a -O0. The program does not crash at -O2 when the code in
question is present. The program crashes when the code is removed.
Nearly everyone seems to realize the code is needed, and removing it
does _not_ produce an equivalent program.
Jeff