This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Document arithmetic overflow semantics


Hi Richard,
> We've said many times that a program that contains an expression of
> the form
>
> 	i = i++;
>
> need not produce the same results in different optimization levels.
>
> You seem to be trying to divide the set of things that make a program
> undefined into two sets: those that we must preserve over optimization
> and those that we need not.  What criteria do you propose to use to choose,
> for each example of undefined behavior, which of those cases we apply?


What makes a program undefined is specified by the front-end's language
specification.  This I have absolutely no comment on.  In some languages
"i = i++" has precisely defined behaviour, in others it does not.

The issue is GCC's internal representations, which shouldn't suffer
from the same issue of poorly defined languages.  Hence, if CSE sees
"x = i++; i = x" it had better understand exactly what "i = i++" means
at the RTL-level.  One might hope that the interpretation of RTL and
TREEs are independent of the source language and target architecture.

Roger
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]