Optimisations and undefined behaviour

Andrew Haley aph@redhat.com
Mon Nov 9 16:16:00 GMT 2015


On 11/09/2015 03:56 PM, David Brown wrote:
> The the compiler could remove the conditional and the debugging message
> - that is what the language standards allow, and that is the smallest
> and fastest code.  But it is not helpful to the developer - it would
> make gcc a poorer tool.

I have to keep saying the same thing.  The same logic and the same
rules inside the compiler enable optimizations which are "obviously
right" and optimizations of the kind you don't like.  Making a
compiler which could do the right thing by these rules is an AI-
complete problem.

Andrew.



More information about the Gcc-help mailing list