When statically evaluating floating-point expressions we convert the final
result to machine number. However, we skipped this conversion if the result was
zero.
This inconsistency was introduced when adding a warning for compile-time
evaluation that gives different result from a run-time evaluation, but left
when this warning was deconstructed. It causes a crash in GNATprove, which
expects all floating-point numbers in the GNAT AST to be in a machine
representation form.
gcc/ada/ChangeLog:
* sem_eval.adb (Check_Non_Static_Context): Remove special handling of
floating-point zero.
Rewrite (N, New_Copy (N));
- if not Is_Floating_Point_Type (T) then
- Set_Realval
- (N, Corresponding_Integer_Value (N) * Small_Value (T));
-
- elsif not UR_Is_Zero (Realval (N)) then
+ if Is_Floating_Point_Type (T) then
Set_Realval (N, Machine_Number (Base_Type (T), Realval (N), N));
Set_Is_Machine_Number (N);
+ else
+ Set_Realval (N, Corresponding_Integer_Value (N) * Small_Value (T));
end if;
end if;