diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2019-07-22 13:57:09 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-07-22 13:57:09 +0000 |
commit | e7f4682af254be73f91ddbb543bc0bc3fcd27659 (patch) | |
tree | 2941b1fc84b3f7262d5c60e646621c1d9818cbd7 /gcc/ada | |
parent | fd90c808628cead705bb4521d9b8beea0edcf2bf (diff) | |
download | gcc-e7f4682af254be73f91ddbb543bc0bc3fcd27659.zip gcc-e7f4682af254be73f91ddbb543bc0bc3fcd27659.tar.gz gcc-e7f4682af254be73f91ddbb543bc0bc3fcd27659.tar.bz2 |
[Ada] Internal error on iterator for limited private discriminated type
This patch further extends the short-circuit, aka optimization, present
in the Check_Constrained_Object procedure used for renaming declarations
to all limited types, so as to prevent type mismatches downstream in
more cases.
2019-07-22 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* sem_ch8.adb (Check_Constrained_Object): Further extend the
special optimization to all limited types.
gcc/testsuite/
* gnat.dg/iter5.adb, gnat.dg/iter5_pkg.ads: New testcase.
From-SVN: r273677
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/sem_ch8.adb | 10 |
2 files changed, 7 insertions, 8 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 85a0a26..0081c3e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,10 @@ 2019-07-22 Eric Botcazou <ebotcazou@adacore.com> + * sem_ch8.adb (Check_Constrained_Object): Further extend the + special optimization to all limited types. + +2019-07-22 Eric Botcazou <ebotcazou@adacore.com> + * exp_attr.adb (Expand_N_Attribute_Reference) <Attribute_Enum_Val>: Set No_Truncation on the N_Unchecked_Type_Conversion built around the argument passed to diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index c9d6151..9caddcc 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -809,18 +809,12 @@ package body Sem_Ch8 is -- in particular with record types with an access discriminant -- that are used in iterators. This is an optimization, but it -- also prevents typing anomalies when the prefix is further - -- expanded. This also applies to limited types with access - -- discriminants. + -- expanded. -- Note that we cannot just use the Is_Limited_Record flag because -- it does not apply to records with limited components, for which -- this syntactic flag is not set, but whose size is also fixed. - elsif (Is_Record_Type (Typ) and then Is_Limited_Type (Typ)) - or else - (Ekind (Typ) = E_Limited_Private_Type - and then Has_Discriminants (Typ) - and then Is_Access_Type (Etype (First_Discriminant (Typ)))) - then + elsif Is_Limited_Type (Typ) then null; else |