]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/25263 (ICE on invalid array bound: int x[1/0];)
authorRoger Sayle <roger@eyesopen.com>
Tue, 6 Dec 2005 14:00:09 +0000 (14:00 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Tue, 6 Dec 2005 14:00:09 +0000 (14:00 +0000)
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

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/array2.C [new file with mode: 0644]

index 36642eb82809d8f56b7bc541e21e0dd2438b0b84..82b99cb3b501ed8130df690ddb474efdf5fd5c8d 100644 (file)
@@ -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
index ca2e221d0f40f54620196220d2b86c3f56002ee1..b5f89fccb064edc950d0b6b97da0697bf2517fd2 100644 (file)
@@ -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;
index 490996b3c4326e3431d84759e42065a60c091adc..6c16c7d430bb9ee7add79c1b386f37068f5fe83e 100644 (file)
@@ -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 (file)
index 0000000..b091d96
--- /dev/null
@@ -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 }
+