diff options
author | Steve Baird <baird@adacore.com> | 2019-09-18 08:32:05 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-09-18 08:32:05 +0000 |
commit | dcbe49a6c41e586e961664512726799a540757ee (patch) | |
tree | 07231a2330abb2bdd851673b99409f8f2329cbf7 /gcc | |
parent | e42183e72bf600aff07cdf051c2166d36fb1889d (diff) | |
download | gcc-dcbe49a6c41e586e961664512726799a540757ee.zip gcc-dcbe49a6c41e586e961664512726799a540757ee.tar.gz gcc-dcbe49a6c41e586e961664512726799a540757ee.tar.bz2 |
[Ada] No Storage_Error for an oversized disabled ghost array object
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ada/freeze.adb | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/ghost7.adb | 6 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/ghost7.ads | 8 |
5 files changed, 26 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c13fa24..0c1c554 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +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. diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index bb17e42..93e91b2 100644 --- a/gcc/ada/freeze.adb +++ b/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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1db62e2..c3f82a5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +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. diff --git a/gcc/testsuite/gnat.dg/ghost7.adb b/gcc/testsuite/gnat.dg/ghost7.adb new file mode 100644 index 0000000..977cdd2 --- /dev/null +++ b/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; diff --git a/gcc/testsuite/gnat.dg/ghost7.ads b/gcc/testsuite/gnat.dg/ghost7.ads new file mode 100644 index 0000000..4042aa3 --- /dev/null +++ b/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 |