https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51446

--- Comment #22 from joseph at codesourcery dot com <joseph at codesourcery dot 
com> ---
On Mon, 2 Oct 2023, eggert at cs dot ucla.edu via Gcc-bugs wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51446
> 
> --- Comment #20 from Paul Eggert <eggert at cs dot ucla.edu> ---
> (In reply to jos...@codesourcery.com from comment #14)
> > This is just the same as other unspecified things like converting an 
> > out-of-range value from floating-point to integer.
> No, because when GCC's constant folding disagrees with machine arithmetic, GCC
> can generate code that violates the relevant standards.

The issue you describe is orthogonal to my comment in this bug.  The 
unspecified cases - both the one I mentioned in my comment and the one in 
the description of this bug - do not require any particular result (choice 
of quiet NaN, choice of value for out-of-range conversion to integer, 
etc.), and in particular do not require a result that could be generated 
by the hardware being used, but they do require that, for each evaluation 
of such an operation in the abstract machine, the implementation behaves 
as if some particular valid choice of result was made for that evaluation; 
wobbly values (some uses of the result behaving as if one choice of value 
were made and other uses behaving as if some other choice were made) are 
not permitted.  (This is similar to the question of whether use of 
uninitialized variables (if not undefined behavior) can produce a wobbly 
value, as such a value naturally results from optimizing a PHI node with 
one uninitialized operand to the value of the other operand.)

Reply via email to