In some cases where the size computation for an object declaration will
unconditionally overflow, the FE generates code to raise Storage_Error
at the point of the object declaration (and may generate an associated
warning). Don't do this if the object declaration is an ignored (i.e.,
disabled) ghost declaration.
2019-09-18 Steve Baird <baird@adacore.com>
gcc/ada/
* freeze.adb (Freeze_Object_Declaration): Do not call
Check_Large_Modular_Array when the object declaration being
frozen is an ignored ghost entity.
gcc/testsuite/
* gnat.dg/ghost7.adb, gnat.dg/ghost7.ads: New testcase.
From-SVN: r275845
+2019-09-18 Steve Baird <baird@adacore.com>
+
+ * freeze.adb (Freeze_Object_Declaration): Do not call
+ Check_Large_Modular_Array when the object declaration being
+ frozen is an ignored ghost entity.
+
2019-09-18 Tom Tromey <tromey@adacore.com>
* make.adb (Initialize): Fix typo.
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;
+2019-09-18 Steve Baird <baird@adacore.com>
+
+ * gnat.dg/ghost7.adb, gnat.dg/ghost7.ads: New testcase.
+
2019-09-18 Olivier Hainque <hainque@adacore.com>
* gnat.dg/system_info1.adb: New testcase.
--- /dev/null
+-- { dg-do compile }
+-- { dg-options "-gnatwa" }
+
+package body Ghost7 is
+ procedure Dummy is null;
+end Ghost7;
--- /dev/null
+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