]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Use accumulator type in expansion of 'Reduce attribute
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 26 Jan 2023 14:59:37 +0000 (15:59 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 16 May 2023 08:30:59 +0000 (10:30 +0200)
commit9a70dce278846340ca1a7adc3e5eb9a3b0012d8b
tree8b6f23030c54e0316132ff246c0bc410c8e5fa7d
parente07e6ea6924e594b337ebf9cb175bc6b8e213923
ada: Use accumulator type in expansion of 'Reduce attribute

The current expansion of the 'Reduce attribute uses the resolution type of
the expression for the accumulator. Now this type can be unresolved or set
to a universal type, for example if it is itself the prefix of the 'Image
attribute, and this may yield a spurious type mismatch error in that case.

This changes the expansion to use the accumulator type instead as defined
by the RM 4.5.10 clause, albeit only in the prefixed case for now.

gcc/ada/

* exp_attr.adb (Expand_N_Attribute_Reference) <Attribute_Reduce>:
Use the canonical accumulator type as the type of the accumulator
in the prefixed case.
gcc/ada/exp_attr.adb