re PR other/42611 (ICE in tree_low_cst, at tree.c:5014)

PR other/42611
	* cfgexpand.c (expand_one_var): Diagnose too large variables.

	* gcc.dg/pr42611.c: New test.

From-SVN: r155641
This commit is contained in:
Jakub Jelinek 2010-01-05 09:42:53 +01:00 committed by Jakub Jelinek
parent 566f27e42c
commit 7604eb4e07
4 changed files with 34 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2010-01-05 Jakub Jelinek <jakub@redhat.com>
PR other/42611
* cfgexpand.c (expand_one_var): Diagnose too large variables.
PR tree-optimization/42508
* tree-sra.c (convert_callers): Check for recursive call
by comparing cgraph nodes instead of decls.

View File

@ -1,5 +1,5 @@
/* A pass for lowering trees to RTL.
Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GCC.
@ -1011,6 +1011,14 @@ expand_one_var (tree var, bool toplevel, bool really_expand)
if (really_expand)
expand_one_register_var (origvar);
}
else if (!host_integerp (DECL_SIZE_UNIT (var), 1))
{
if (really_expand)
{
error ("size of variable %q+D is too large", var);
expand_one_error_var (var);
}
}
else if (defer_stack_allocation (var, toplevel))
add_stack_var (origvar);
else

View File

@ -1,5 +1,8 @@
2010-01-05 Jakub Jelinek <jakub@redhat.com>
PR other/42611
* gcc.dg/pr42611.c: New test.
PR tree-optimization/42508
* g++.dg/opt/pr42508.C: New test.

View File

@ -0,0 +1,19 @@
/* PR other/42611 */
/* { dg-do compile } */
/* { dg-options "" } */
#define L \
(sizeof (__SIZE_TYPE__) == 1 ? __SCHAR_MAX__ \
: sizeof (__SIZE_TYPE__) == sizeof (short) ? __SHRT_MAX__ \
: sizeof (__SIZE_TYPE__) == sizeof (int) ? __INT_MAX__ \
: sizeof (__SIZE_TYPE__) == sizeof (long) ? __LONG_MAX__ \
: sizeof (__SIZE_TYPE__) == sizeof (long long) ? __LONG_LONG_MAX__ \
: __INTMAX_MAX__)
struct S { int a; char b[L]; };
void
foo (void)
{
struct S s; /* { dg-error "is too large" } */
asm volatile ("" : : "r" (&s));
}