diff options
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr43220.c | 28 | ||||
-rw-r--r-- | gcc/tree-ssa-ccp.c | 5 |
4 files changed, 43 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 70fa628..f243dbf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,10 @@ 2010-03-01 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/43220 + * tree-ssa-ccp.c (optimize_stack_restore): Do not optimize + BUILT_IN_STACK_{SAVE,RESTORE} around alloca. + +2010-03-01 Richard Guenther <rguenther@suse.de> Martin Jambor <mjambor@suse.cz> PR middle-end/41250 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8173802..6e72856 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2010-03-01 Richard Guenther <rguenther@suse.de> + PR tree-optimization/43220 + * gcc.c-torture/execute/pr43220.c: New testcase. + +2010-03-01 Richard Guenther <rguenther@suse.de> + PR middle-end/43213 * gcc.dg/pr43213.c: New testcase. diff --git a/gcc/testsuite/gcc.c-torture/execute/pr43220.c b/gcc/testsuite/gcc.c-torture/execute/pr43220.c new file mode 100644 index 0000000..4709f17 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr43220.c @@ -0,0 +1,28 @@ +void *volatile p; + +int +main (void) +{ + int n = 0; +lab:; + { + int x[n % 1000 + 1]; + x[0] = 1; + x[n % 1000] = 2; + p = x; + n++; + } + + { + int x[n % 1000 + 1]; + x[0] = 1; + x[n % 1000] = 2; + p = x; + n++; + } + + if (n < 1000000) + goto lab; + + return 0; +} diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index a4869d2..03c3500 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -3203,7 +3203,10 @@ optimize_stack_restore (gimple_stmt_iterator i) continue; callee = gimple_call_fndecl (stmt); - if (!callee || DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL) + if (!callee + || DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL + /* All regular builtins are ok, just obviously not alloca. */ + || DECL_FUNCTION_CODE (callee) == BUILT_IN_ALLOCA) return NULL_TREE; if (DECL_FUNCTION_CODE (callee) == BUILT_IN_STACK_RESTORE) |