As-if Rule (was: ARMv8, GCC 4.9 and necessary code optimized away)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> ARM intrinsics, as with most constructs in programming languages are
> governed by the 'as if' rule.  That is, the behaviour (from the
> view-point of the abstract machine defined by the programming language)
> is as if the operation were performed.  If the compiler can determine
> that an alternative code sequence can satisfy that requirement it is at
> liberty to substitute that alternative sequence.

I'm not sure I would agree. GCC needs to know intent (q.v.), and I'm
guessing that's probably an NP-complete problem.

C++11 got constexpr to specify intent, so I know the committee is
familiar with the concept.

Sorry to sound argumentative. I'm frustrated when a correct program is
turned into a misbehaving program :)

Maybe as a stop gap GCC could warn when its completely discarding
blocks of code. As far as I know, the only warning at the moment is
for -Wstrict-overflow when an optimization is taken due to integer
overflow. And maybe the "unreachable" because of an early return.

Jeff



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux