diff options
author | Bob Duff <duff@adacore.com> | 2019-12-12 10:02:27 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-12-12 10:02:27 +0000 |
commit | 5d3983bca523f337333cf6f749d6489014264572 (patch) | |
tree | a09ae129b6d08211ec36b6e7fd8821bccfe9c6b6 | |
parent | c2f3e1a3e369fe549fa76e9821d2e17bc3d55dc7 (diff) | |
download | gcc-5d3983bca523f337333cf6f749d6489014264572.zip gcc-5d3983bca523f337333cf6f749d6489014264572.tar.gz gcc-5d3983bca523f337333cf6f749d6489014264572.tar.bz2 |
[Ada] Crash on Descriptor_Size attribute
2019-12-12 Bob Duff <duff@adacore.com>
gcc/ada/
* sem_attr.adb (Eval_Attribute): Never mark T'Descriptor_Size as
static, even if T is a static subtype, because otherwise we will
request the value of the attribute, which will crash because we
have not evaluated it.
From-SVN: r279287
-rw-r--r-- | gcc/ada/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ada/sem_attr.adb | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index a4dc138..4ad9092 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2019-12-12 Bob Duff <duff@adacore.com> + + * sem_attr.adb (Eval_Attribute): Never mark T'Descriptor_Size as + static, even if T is a static subtype, because otherwise we will + request the value of the attribute, which will crash because we + have not evaluated it. + 2019-12-12 Ed Schonberg <schonberg@adacore.com> * exp_ch5.adb (Expand_N_Assognment_Statement): Extend the diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 95de2e4..0cd8e08 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -7852,6 +7852,8 @@ package body Sem_Attr is -- is legal, since here this expression appears in a statically -- unevaluated position, so it does not actually raise an exception. + -- + -- T'Descriptor_Size is never static, even if T is static. if Is_Scalar_Type (P_Entity) and then (not Is_Generic_Type (P_Entity)) @@ -7865,6 +7867,7 @@ package body Sem_Attr is (No (E2) or else (Is_Static_Expression (E2) and then Is_Scalar_Type (Etype (E1)))) + and then Id /= Attribute_Descriptor_Size then Static := True; Set_Is_Static_Expression (N, True); |