From: Justin Squirek Date: Fri, 25 May 2018 09:04:37 +0000 (+0000) Subject: [Ada] Fix for freezing of expression functions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=320fbd1ebe24af4b2059759e7432e4c294eb9170;p=gcc.git [Ada] Fix for freezing of expression functions 2018-05-25 Justin Squirek 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 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 256ecb83c6d..2e5fd67e46b 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2018-05-25 Justin Squirek + + * 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 * 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 3395c2122fb..7c8ce026a5d 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)