aboutsummaryrefslogtreecommitdiff
path: root/libcpp/include/cpplib.h
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2025-12-07 23:40:25 +0100
committerEric Botcazou <ebotcazou@adacore.com>2025-12-07 23:42:49 +0100
commit09da4112cbb38de230973ea8296816371ecb38b4 (patch)
treeec68585fa5c8d390a49239eb2ef6bc075e70cce0 /libcpp/include/cpplib.h
parent01d4414e3ea4090bffe644c9e2d2834f451ee6a5 (diff)
downloadgcc-09da4112cbb38de230973ea8296816371ecb38b4.zip
gcc-09da4112cbb38de230973ea8296816371ecb38b4.tar.gz
gcc-09da4112cbb38de230973ea8296816371ecb38b4.tar.bz2
Ada: Fix wrong Accum_Type inferred for a reduction expression
This was reported as a regression in GCC 14: the compiler resolves Accum_Type to Positive for a reduction expression whose "expected subtype" is Positive, which means that 0 cannot be used as initial value in the expression: Sum : Positive := V'Reduce ("+", 0); without always raising Constraint_Error as run time. That's not the intent according to T. Taft in https://forum.ada-lang.io/t/regression-in-gnat-14/890 so this changes the resolution to use the base type (Integer) instead. gcc/ada/ PR ada/115349 * sem_attr.adb (Resolve_Attribute) <Attribute_Reduce>: Use the base type as Accum_Type if the reducer is an operator from Standard and the type is numeric. Use the type of the first operand for other operators. Streamline the error message given for limited types. gcc/testsuite/ * gnat.dg/reduce3.adb: New test.
Diffstat (limited to 'libcpp/include/cpplib.h')
0 files changed, 0 insertions, 0 deletions