diff options
author | Ed Schonberg <schonberg@adacore.com> | 2019-08-19 08:37:18 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-08-19 08:37:18 +0000 |
commit | fcef060c9b321edcb24a56616588e712c22029ba (patch) | |
tree | fa2ac7b8b70693305f9e74b04b5dac7f11a2c259 /gcc/ada | |
parent | c70220382300ae326ad63fe54c5a32da202d1f13 (diff) | |
download | gcc-fcef060c9b321edcb24a56616588e712c22029ba.zip gcc-fcef060c9b321edcb24a56616588e712c22029ba.tar.gz gcc-fcef060c9b321edcb24a56616588e712c22029ba.tar.bz2 |
[Ada] Crash on object initialization that is call to expression function
This patch fixes a compiler abort on an object declaration for a
class-wide type whose expression is a call to an expression function
that returns type extension.
2019-08-19 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_res.adb (Resolve_Call): A call to an expression function
freezes when expander is active, unless the call appears within
the body of another expression function,
gcc/testsuite/
* gnat.dg/expr_func9.adb: New testcase.
From-SVN: r274662
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ada/sem_res.adb | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 932ff97..1f490b3 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2019-08-19 Ed Schonberg <schonberg@adacore.com> + + * sem_res.adb (Resolve_Call): A call to an expression function + freezes when expander is active, unless the call appears within + the body of another expression function, + 2019-08-19 Dmitriy Anisimkov <anisimko@adacore.com> * libgnat/s-os_lib.ads, libgnat/s-os_lib.adb (To_Ada, To_C): New diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 8f2e358..7a52b90 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -6314,13 +6314,15 @@ package body Sem_Res is -- an expression function may appear when it is part of a default -- expression in a call to an initialization procedure, and must be -- frozen now, even if the body is inserted at a later point. + -- Otherwise, the call freezes the expression if expander is active, + -- for example as part of an object declaration. if Is_Entity_Name (Subp) and then not In_Spec_Expression and then not Is_Expression_Function_Or_Completion (Current_Scope) and then (not Is_Expression_Function_Or_Completion (Entity (Subp)) - or else Scope (Entity (Subp)) = Current_Scope) + or else Expander_Active) then if Is_Expression_Function (Entity (Subp)) then |