Commit b67723dd by Nicolas Roche Committed by Pierre-Marie de Rodat

[Ada] Ensure that Scan_Real result does not depend on trailing zeros

Previous change in that procedure to handle overflow issues during
scanning removed the special handling for trailing zeros in the decimal
part. Beside the absence of overflow during scanning the special
handling of these zeros is still necessary.

2019-09-18  Nicolas Roche  <roche@adacore.com>

gcc/ada/

	* libgnat/s-valrea.adb (Scan_Integral_Digits): New procedure.
	(Scan_Decimal_Digits): New procedure.
	(As_Digit): New function.
	(Scan_Real): Use Scan_Integral_Digits and Scan_Decimal_Digits.

gcc/testsuite/

	* gnat.dg/float_value2.adb: New testcase.

From-SVN: r275849
parent d2880e69
2019-09-18 Nicolas Roche <roche@adacore.com>
* libgnat/s-valrea.adb (Scan_Integral_Digits): New procedure.
(Scan_Decimal_Digits): New procedure.
(As_Digit): New function.
(Scan_Real): Use Scan_Integral_Digits and Scan_Decimal_Digits.
2019-09-18 Claire Dross <dross@adacore.com> 2019-09-18 Claire Dross <dross@adacore.com>
* exp_attr.adb (Expand_N_Attribute_Reference): Call routine from * exp_attr.adb (Expand_N_Attribute_Reference): Call routine from
......
2019-09-18 Nicolas Roche <roche@adacore.com>
* gnat.dg/float_value2.adb: New testcase.
2019-09-18 Vadim Godunko <godunko@adacore.com> 2019-09-18 Vadim Godunko <godunko@adacore.com>
* gnat.dg/expect4.adb: New testcase. * gnat.dg/expect4.adb: New testcase.
......
-- { dg-do run }
procedure Float_Value2 is
F1 : Long_Long_Float := Long_Long_Float'Value ("1.e40");
F2 : Long_Long_Float := Long_Long_Float'Value ("1.0e40");
begin
if F1 /= F2 then
raise Program_Error;
end if;
end Float_Value2;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment