diff options
| author | Denis Mazzucato <mazzucato@adacore.com> | 2025-09-24 17:25:39 +0200 |
|---|---|---|
| committer | Marc Poulhiès <dkm@gcc.gnu.org> | 2025-12-05 13:22:52 +0100 |
| commit | 7fd14b6c9d191a715303a4dae3d25706131aed13 (patch) | |
| tree | a71338af5b5c966ae630acd43d7bdc24ee9d9654 /gcc/fortran/array.cc | |
| parent | 1da0e5c1405e87e9f2a11ed358b40dff21085657 (diff) | |
| download | gcc-7fd14b6c9d191a715303a4dae3d25706131aed13.zip gcc-7fd14b6c9d191a715303a4dae3d25706131aed13.tar.gz gcc-7fd14b6c9d191a715303a4dae3d25706131aed13.tar.bz2 | |
ada: Fix reducer selection when resolving 'Reduce attribute
This patch ensures that, during the 'Reduce attribute resolution phase, the
selected reducer subprogram exists, is not ambiguous, and has the proper reducer
profile. Before we could have selected a wrong interpretation.
gcc/ada/ChangeLog:
* sem_attr.adb
(Analyze_Attribute): Set the type of the attribute expression only when
not ambiguous (it will later be resolved correctly). Emit an error in
case the type is limited.
(Resolve_Attribute): Emit an error if the reducer has no entity.
(Get_Value_Subtype): Try to resolve the Value_Subtype of the aggregate
expression, and if it succeeds, set the candidate reducer subprogram.
(Is_Reducer_Subprogram): Check whether the selected candidate has a
proper reducer profile.
(Make_Array_Type): Return simple array type to resolve the array
aggregate against it.
(Resolve_Attribute): Reimplement the resolution of Reduce attribute,
including its prefix.
* sem_res.adb (Resolve_Declare_Expression): Save and restore variables
that may be hidden by the local declaration. Only setting the new
entities is problematic when dealing with copied trees where the ref is
lost (eg. when resolving array aggregates).
* exp_attr.adb (Expand_N_Attribute_Reference): Remove tricks to resolve
the reducer in case of faulty resolution as not needed anymore.
gcc/testsuite/ChangeLog:
* gnat.dg/reduce1.adb: Adjust expected error message.
Diffstat (limited to 'gcc/fortran/array.cc')
0 files changed, 0 insertions, 0 deletions
