aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2020-09-03 09:54:40 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-10-23 04:24:58 -0400
commit995e0727ce999d3f4d5976e98ce31c70cb0469ed (patch)
treeb97e1e104fd8112fa1beaae9ff915daec1104201 /gcc/ada
parent0edbf7fa1228faabed48586c7f036afe311c1c51 (diff)
downloadgcc-995e0727ce999d3f4d5976e98ce31c70cb0469ed.zip
gcc-995e0727ce999d3f4d5976e98ce31c70cb0469ed.tar.gz
gcc-995e0727ce999d3f4d5976e98ce31c70cb0469ed.tar.bz2
[Ada] Crash on expression function and access type
gcc/ada/ * freeze.adb (Freeze_Type_Refs): Add guard on freezing of the designated type of an access type appearing in the expression, when expression includes an explicit dereference whose prefix includes a function call.
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/freeze.adb20
1 files changed, 10 insertions, 10 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index b95a216..2118307 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -8008,19 +8008,19 @@ package body Freeze is
if Nkind (Node) in N_Has_Etype
and then Present (Etype (Node))
and then Is_Access_Type (Etype (Node))
- and then Nkind (Parent (Node)) = N_Function_Call
- and then Node = Controlling_Argument (Parent (Node))
then
- Check_And_Freeze_Type (Designated_Type (Etype (Node)));
+ if Nkind (Parent (Node)) = N_Function_Call
+ and then Node = Controlling_Argument (Parent (Node))
+ then
+ Check_And_Freeze_Type (Designated_Type (Etype (Node)));
- -- An explicit dereference freezes the designated type as well,
- -- even though that type is not attached to an entity in the
- -- expression.
+ -- An explicit dereference freezes the designated type as well,
+ -- even though that type is not attached to an entity in the
+ -- expression.
- elsif Nkind (Node) in N_Has_Etype
- and then Nkind (Parent (Node)) = N_Explicit_Dereference
- then
- Check_And_Freeze_Type (Designated_Type (Etype (Node)));
+ elsif Nkind (Parent (Node)) = N_Explicit_Dereference then
+ Check_And_Freeze_Type (Designated_Type (Etype (Node)));
+ end if;
-- An iterator specification freezes the iterator type, even though
-- that type is not attached to an entity in the construct.