summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2008-03-31 19:14:08 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2008-03-31 19:14:08 +0000
commit7866ca04c49ac3c8913b7d17b8aa6b8b71653050 (patch)
tree0f65879b64d2251911ce095698a002384eaf0bd2
parent70a866cf8dac73a244d12c64eba8aceb51fec209 (diff)
downloadppe42-gcc-7866ca04c49ac3c8913b7d17b8aa6b8b71653050.tar.gz
ppe42-gcc-7866ca04c49ac3c8913b7d17b8aa6b8b71653050.zip
* decl.c (gnat_to_gnu_entity) <object>: Do not force a non-null
size if it has overflowed. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@133768 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/decl.c8
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gnat.dg/object_overflow.adb14
4 files changed, 30 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index d10a213bb81..f5b9df21c6d 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,10 @@
+2008-03-31 Eric Botcazou <ebotcazou@adacore.com>
+
+ * decl.c (gnat_to_gnu_entity) <object>: Do not force a non-null
+ size if it has overflowed.
+
2008-03-31 Olivier Hainque <hainque@adacore.com>
- Eric Botcazou <botcazou@adacore.com>
+ Eric Botcazou <ebotcazou@adacore.com>
* utils2.c (find_common_type): Document assumption on t1/t2 vs
lhs/rhs. Force use of lhs type if smaller, whatever the modes.
diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c
index 88198745fa8..6f92fac5428 100644
--- a/gcc/ada/decl.c
+++ b/gcc/ada/decl.c
@@ -640,8 +640,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
clause, as we would lose useful information on the view size
(e.g. for null array slices) and we are not allocating the object
here anyway. */
- if (((gnu_size && integer_zerop (gnu_size))
- || (TYPE_SIZE (gnu_type) && integer_zerop (TYPE_SIZE (gnu_type))))
+ if (((gnu_size
+ && integer_zerop (gnu_size)
+ && !TREE_OVERFLOW (gnu_size))
+ || (TYPE_SIZE (gnu_type)
+ && integer_zerop (TYPE_SIZE (gnu_type))
+ && !TREE_OVERFLOW (TYPE_SIZE (gnu_type))))
&& (!Is_Constr_Subt_For_UN_Aliased (Etype (gnat_entity))
|| !Is_Array_Type (Etype (gnat_entity)))
&& !Present (Renamed_Object (gnat_entity))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b62c44e6650..ba35c2b2542 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2008-03-31 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/object_overflow.adb: New test.
+
2008-03-31 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR middle-end/30186
diff --git a/gcc/testsuite/gnat.dg/object_overflow.adb b/gcc/testsuite/gnat.dg/object_overflow.adb
new file mode 100644
index 00000000000..820e93656e6
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/object_overflow.adb
@@ -0,0 +1,14 @@
+-- { dg-do compile }
+
+procedure Object_Overflow is
+
+ type Rec is null record;
+
+ procedure Proc (x : Rec) is begin null; end;
+
+ type Arr is array(Long_Integer) of Rec;
+ Obj : Arr; -- { dg-warning "Storage_Error will be raised" }
+
+begin
+ Proc (Obj(1));
+end;
OpenPOWER on IntegriCloud