float_attributes_overflows.adb
930 Bytes
-
[Ada] Improper behavior of floating-point attributes · ef22a3b2
This patch fixes an error in the handling of attributes Pred qnd Succ when applied to the limit values of a floating-point type. The RM mandates that such operations must raise constraint_error, but GNAT generated in most cases an infinite value, regardless of whether overflow checks were enabled. 2018-05-29 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * libgnat/s-fatgen.adb (Succ, Pred): Raise Constraint_Error unconditionally when applied to the largest positive (resp. largest negative) value of a floating-point type. gcc/testsuite/ * gnat.dg/float_attributes_overflows.adb: New testcase. From-SVN: r260882
Ed Schonberg committed