aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2019-12-16 10:34:42 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-12-16 10:34:42 +0000
commitc85dda723615051018ea8e19e5f0431e5ffdae55 (patch)
treee797aec794fb34d6d31c60229916673083cea969 /gcc
parent3c08de34076ffc085e335cc9c89661945823c594 (diff)
downloadgcc-c85dda723615051018ea8e19e5f0431e5ffdae55.zip
gcc-c85dda723615051018ea8e19e5f0431e5ffdae55.tar.gz
gcc-c85dda723615051018ea8e19e5f0431e5ffdae55.tar.bz2
[Ada] Crash on constrained container in generalized indexing operation
2019-12-16 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_ch4.adb (Try_Container_Indexing): In the case of a derived container type, use the base type to look for candidate indexing operations, because the object may be a constrained subtype or itype with no explicit declaration. Candidate indexing operations are found in the same scope and list of declarations as the declaration of the base type. From-SVN: r279432
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog9
-rw-r--r--gcc/ada/sem_ch4.adb5
2 files changed, 13 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 79d2042..5533c1c 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,14 @@
2019-12-16 Ed Schonberg <schonberg@adacore.com>
+ * sem_ch4.adb (Try_Container_Indexing): In the case of a derived
+ container type, use the base type to look for candidate indexing
+ operations, because the object may be a constrained subtype or
+ itype with no explicit declaration. Candidate indexing
+ operations are found in the same scope and list of declarations
+ as the declaration of the base type.
+
+2019-12-16 Ed Schonberg <schonberg@adacore.com>
+
* scng.adb (Scan): In Ada2020, a left-bracket indicates the
start of an homogenous aggregate.
* par-ch4.adb (P_Reduction_Attribute_Reference): New procedure.
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 80be4d6..0158623 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -8289,13 +8289,16 @@ package body Sem_Ch4 is
-- Note that predefined containers are typically all derived from one of
-- the Controlled types. The code below is motivated by containers that
-- are derived from other types with a Reference aspect.
+ -- Note as well that we need to examine the base type, given that
+ -- the container object may be a constrained subtype or itype which
+ -- does not have an explicit declaration,
elsif Is_Derived_Type (C_Type)
and then Etype (First_Formal (Entity (Func_Name))) /= Pref_Typ
then
Func_Name :=
Find_Indexing_Operations
- (T => C_Type,
+ (T => Base_Type (C_Type),
Nam => Chars (Func_Name),
Is_Constant => Is_Constant_Indexing);
end if;