https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115349
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Eric Botcazou <[email protected]>: https://gcc.gnu.org/g:09da4112cbb38de230973ea8296816371ecb38b4 commit r16-5950-g09da4112cbb38de230973ea8296816371ecb38b4 Author: Eric Botcazou <[email protected]> Date: Sun Dec 7 23:40:25 2025 +0100 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.
