aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2005-12-06 14:00:09 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2005-12-06 14:00:09 +0000
commit9116d529f6d79990fc5b7315f9f905f9d2ec6fb7 (patch)
tree0eb762891764cfb8cb423cefc2632ddc553ab720 /gcc
parentc0328823536bcf18bcff02f3f6bf503da93a5dfb (diff)
downloadgcc-9116d529f6d79990fc5b7315f9f905f9d2ec6fb7.zip
gcc-9116d529f6d79990fc5b7315f9f905f9d2ec6fb7.tar.gz
gcc-9116d529f6d79990fc5b7315f9f905f9d2ec6fb7.tar.bz2
re PR c++/25263 (ICE on invalid array bound: int x[1/0];)
PR c++/25263 * decl.c (compute_array_index_type): Check that itype is an INTEGER_CST node before testing/clearing TREE_OVERFLOW. * g++.dg/other/array2.C: New test case. From-SVN: r108119
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/other/array2.C6
4 files changed, 19 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 36642eb..82b99cb 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2005-12-06 Roger Sayle <roger@eyesopen.com>
+
+ PR c++/25263
+ * decl.c (compute_array_index_type): Check that itype is an
+ INTEGER_CST node before testing/clearing TREE_OVERFLOW.
+
2005-12-05 Daniel Berlin <dberlin@dberlin.org>
* ptree.c (cxx_print_decl): Update to check for decl_common
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index ca2e221..b5f89fc 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -6374,7 +6374,8 @@ compute_array_index_type (tree name, tree size)
/* Make sure that there was no overflow when creating to a signed
index type. (For example, on a 32-bit machine, an array with
size 2^32 - 1 is too big.) */
- else if (TREE_OVERFLOW (itype))
+ else if (TREE_CODE (itype) == INTEGER_CST
+ && TREE_OVERFLOW (itype))
{
error ("overflow in array dimension");
TREE_OVERFLOW (itype) = 0;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 490996b..6c16c7d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-12-06 Roger Sayle <roger@eyesopen.com>
+
+ PR c++/25263
+ * g++.dg/other/array2.C: New test case.
+
2005-12-05 Geoffrey Keating <geoffk@apple.com>
* gcc.dg/darwin-weakimport-3.c: New.
diff --git a/gcc/testsuite/g++.dg/other/array2.C b/gcc/testsuite/g++.dg/other/array2.C
new file mode 100644
index 0000000..b091d96
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/array2.C
@@ -0,0 +1,6 @@
+// PR c++/25263
+// { dg-do compile }
+
+int x[1/0]; // { dg-warning "division by zero" }
+ // { dg-error "constant" "constant" { target *-*-* } 4 }
+