Commit 9116d529 by Roger Sayle Committed by Roger Sayle

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
parent c0328823
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
......
......@@ -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;
......
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.
// PR c++/25263
// { dg-do compile }
int x[1/0]; // { dg-warning "division by zero" }
// { dg-error "constant" "constant" { target *-*-* } 4 }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment