aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Squirek <squirek@adacore.com>2018-05-25 09:04:37 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-05-25 09:04:37 +0000
commit320fbd1ebe24af4b2059759e7432e4c294eb9170 (patch)
tree3f293e82e1225da8a39e91729799cdb0de0e5744
parent29192f7b77e67ae3bee0138bd0f7262e899226ab (diff)
downloadgcc-320fbd1ebe24af4b2059759e7432e4c294eb9170.zip
gcc-320fbd1ebe24af4b2059759e7432e4c294eb9170.tar.gz
gcc-320fbd1ebe24af4b2059759e7432e4c294eb9170.tar.bz2
[Ada] Fix for freezing of expression functions
2018-05-25 Justin Squirek <squirek@adacore.com> gcc/ada/ * exp_ch6.adb (Expand_Simple_Function_Return): Add guard in check to generate code for 6.5(8-10) so that we don't get an assertion error when dealing with an incomplete return type. From-SVN: r260733
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/exp_ch6.adb8
2 files changed, 13 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 256ecb8..2e5fd67 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2018-05-25 Justin Squirek <squirek@adacore.com>
+
+ * exp_ch6.adb (Expand_Simple_Function_Return): Add guard in check to
+ generate code for 6.5(8-10) so that we don't get an assertion error
+ when dealing with an incomplete return type.
+
2018-05-25 Arnaud Charlet <charlet@adacore.com>
* pprint.adb (Expression_Name): Strip too long expressions to avoid
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index 3395c21..7c8ce02 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -6759,7 +6759,13 @@ package body Exp_Ch6 is
-- conversion or a formal parameter, because in that case the tag of
-- the expression might differ from the tag of the specific result type.
- if Is_Tagged_Type (Utyp)
+ -- We must also verify an underlying type exists for the return type in
+ -- case it is incomplete - in which case is not necessary to generate a
+ -- check anyway since an incomplete limited tagged return type would
+ -- qualify as a premature usage.
+
+ if Present (Utyp)
+ and then Is_Tagged_Type (Utyp)
and then not Is_Class_Wide_Type (Utyp)
and then (Nkind_In (Exp, N_Type_Conversion,
N_Unchecked_Type_Conversion)