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

--- Comment #6 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
(In reply to Andrew Pinski from comment #5)
> Try -std=c99 or -fexcess-precision=standard which will get you the behavior
> you want.

This is not what is documented: "By default, -fexcess-precision=fast is in
effect; this means that operations may be carried out in a wider precision than
the types specified in the source if that would result in faster code, and it
is unpredictable when rounding to the types specified in the source code takes
place."

This means that in

  double x = 1.1 * 1.2;

x can be kept with excess precision (typically 64 bits instead of 53) or can be
rounded to double depending on its use.

But here, one has:

  unsigned long long a6 = a.dbl * 1e6;

This is no longer just a rounding of a floating-point value, but a conversion
to an integer type. From -fexcess-precision=fast, one cannot decide whether a6
will be 0 or 1, but once the value of a6 has been observed, it should no longer
be allowed to change.

Reply via email to