Re: 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]

 



On 06/01/2016 01:09 PM, Jeffrey Walton wrote:
>> 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.),

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.

> Maybe as a stop gap GCC could warn when its completely discarding
> blocks of code.

You'd get a lot of false positives, especially with template
code.  So much so that everyone would turn it off.

It's like this: you can waste your time tilting at windmills or get on
with more productive and enjoyable activities.

When people first discover that their code has been "miscompiled" by
GCC they often react with shock and denial, progressing through anger
and frustration, as you describe.  Some never get past that, but
others move onto dialogue and attempts at bargaining, which is where
you're at now.  You could skip depression and move on quickly to
acceptance, learning the fully-supported ways to get GCC to do what
you want.

Those of us who have answered questions on gcc-help have seen this
many, many times over the years.

Andrew.


https://en.wikipedia.org/wiki/K%C3%BCbler-Ross_model



[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