Problem: When Passed_By_Reference is used on an incomplete type (e.g.
`type T; B : Boolean := T'Passed_By_Reference;`) GNAT crashes in Gigi
because it doesn't know the size of T.  Solution: Reject programs that
use Passed_By_Reference on incomplete types, just like what is currently
done for the Alignment attribute.

Tested on x86_64-pc-linux-gnu, committed on trunk

2020-06-16  Ghjuvan Lacambre  <lacam...@adacore.com>

gcc/ada/

        * sem_attr.adb (Analyze_Attribute): Add
        Check_Not_Incomplete_Type call.
--- gcc/ada/sem_attr.adb
+++ gcc/ada/sem_attr.adb
@@ -5202,6 +5202,7 @@ package body Sem_Attr is
       when Attribute_Passed_By_Reference =>
          Check_E0;
          Check_Type;
+         Check_Not_Incomplete_Type;
          Set_Etype (N, Standard_Boolean);
 
       ------------------

Reply via email to