--- gcc/ada/freeze.adb +++ gcc/ada/freeze.adb @@ -3569,7 +3569,8 @@ package body Freeze is Error_Msg_N ("\??use explicit size clause to set size", E); end if; - if Is_Array_Type (Typ) then + -- Declaring a too-big array in disabled ghost code is OK + if Is_Array_Type (Typ) and then not Is_Ignored_Ghost_Entity (E) then Check_Large_Modular_Array (Typ); end if; end Freeze_Object_Declaration; --- /dev/null new file mode 100644 +++ gcc/testsuite/gnat.dg/ghost7.adb @@ -0,0 +1,6 @@ +-- { dg-do compile } +-- { dg-options "-gnatwa" } + +package body Ghost7 is + procedure Dummy is null; +end Ghost7; --- /dev/null new file mode 100644 +++ gcc/testsuite/gnat.dg/ghost7.ads @@ -0,0 +1,8 @@ +pragma Restrictions (No_Exception_Propagation); + +package Ghost7 is + type Word64 is mod 2**64; + type My_Array_Type is array (Word64) of Boolean; + My_Array : My_Array_Type with Ghost; + procedure Dummy; +end Ghost7; \ No newline at end of file