diff options
author | Gary Dismukes <dismukes@adacore.com> | 2024-02-27 22:05:55 +0000 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-05-16 10:49:34 +0200 |
commit | 9ec20f1f84ad19bb8e2020657ee4c851ba5cd7b0 (patch) | |
tree | f3772236d8c74d9e82c5de09e2eaa27111cae875 /gcc/tree-vectorizer.h | |
parent | 568c79570a569256d6191e20a6491ba304b28a04 (diff) | |
download | gcc-9ec20f1f84ad19bb8e2020657ee4c851ba5cd7b0.zip gcc-9ec20f1f84ad19bb8e2020657ee4c851ba5cd7b0.tar.gz gcc-9ec20f1f84ad19bb8e2020657ee4c851ba5cd7b0.tar.bz2 |
ada: Exception on Indefinite_Vector aggregate with loop_parameter_specification
Constraint_Error is raised on evaluation of a container aggregate with
a loop_parameter_specification for the type Indefinite_Vector. This
happens due to the Aggregate aspect for type Indefinite_Vector specifying
the Empty_Vector constant for the type's Empty operation rather than
using the type's primitive Empty function. This problem shows up as
a recent regression relative to earlier compilers, evidently due to
recent fixes in the container aggregate area, which uncovered this
issue of the wrong specification in Ada.Containers.Indefinite_Vectors.
The compiler incorrectly initializes the aggregate object using the
Empty_Vector constant rather than invoking the New_Vector function
to allocate the vector object with the appropriate number of elements,
and subsequent calls to Replace_Element fail because the vector object
is empty.
In addition to correcting the Indefinite_Vectors generic package,
checking is added to give an error for an attempt to specify the
Empty operation as a constant rather than a function. (Also note
that another AdaCore package that needs a similar correction is
the VSS.Vector_Strings package.)
gcc/ada/
* libgnat/a-coinve.ads (type Vector): In the Aggregate aspect for
this type, the Empty operation is changed to denote the Empty
function, rather than the Empty_Vector constant.
* exp_aggr.adb (Expand_Container_Aggregate): Remove code for
handling the case where the Empty_Subp denotes a constant object,
which should never happen (and add an assertion that Empty_Subp
must denote a function).
* sem_ch13.adb (Valid_Empty): No longer allow the entity to be an
E_Constant, and require the (optional) parameter of an Empty
function to be of a signed integer type (rather than any integer
type).
Diffstat (limited to 'gcc/tree-vectorizer.h')
0 files changed, 0 insertions, 0 deletions