From: Jakub Jelinek Date: Wed, 10 Sep 2008 08:00:40 +0000 (+0200) Subject: re PR tree-optimization/37353 (ICE: vector VEC(gimple,base) push domain error, in... X-Git-Tag: releases/gcc-4.4.0~2520 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6b672a290664a1ea25964af68906199a342528f3;p=thirdparty%2Fgcc.git re PR tree-optimization/37353 (ICE: vector VEC(gimple,base) push domain error, in tree_call_cdce at tree-call-cdce.c:890) PR tree-optimization/37353 * tree-call-cdce.c (cond_dead_built_in_calls): Remove. (shrink_wrap_conditional_dead_built_in_calls): Add calls argument, use calls instead of cond_dead_built_in_calls. (tree_call_cdce): Add cond_dead_built_in_calls automatic variable, initalize the vector only before adding first entry. Use VEC_safe_push instead of VEC_quick_push. Pass cond_dead_built_in_calls to shrink_wrap_conditional_dead_built_in_calls call. * gcc.dg/pr37353.c: New test. From-SVN: r140208 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 93421f715327..8c231a2b2e59 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2008-09-10 Jakub Jelinek + + PR tree-optimization/37353 + * tree-call-cdce.c (cond_dead_built_in_calls): Remove. + (shrink_wrap_conditional_dead_built_in_calls): Add calls argument, use + calls instead of cond_dead_built_in_calls. + (tree_call_cdce): Add cond_dead_built_in_calls automatic variable, + initalize the vector only before adding first entry. Use VEC_safe_push + instead of VEC_quick_push. Pass cond_dead_built_in_calls to + shrink_wrap_conditional_dead_built_in_calls call. + 2008-09-10 Ira Rosen PR tree-optimization/37385 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b9e444298aaf..51332f366d3c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-09-10 Jakub Jelinek + + PR tree-optimization/37353 + * gcc.dg/pr37353.c: New test. + 2008-09-10 Martin Michlmayr Ira Rosen diff --git a/gcc/testsuite/gcc.dg/pr37353.c b/gcc/testsuite/gcc.dg/pr37353.c new file mode 100644 index 000000000000..07d73d0ebe7b --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr37353.c @@ -0,0 +1,15 @@ +/* PR tree-optimization/37353 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +extern double exp (double); + +#define A exp (arg); +#define B A A A A A A A A A A +#define C B B B B B B B B B B + +void +foo (double arg) +{ + C +} diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c index f59f083d5c98..da66138a466d 100644 --- a/gcc/tree-call-cdce.c +++ b/gcc/tree-call-cdce.c @@ -99,8 +99,6 @@ typedef struct input_domain bool is_ub_inclusive; } inp_domain; -static VEC (gimple, heap) *cond_dead_built_in_calls; - /* A helper function to construct and return an input domain object. LB is the lower bound, HAS_LB is a boolean flag indicating if the lower bound exists, @@ -844,18 +842,18 @@ shrink_wrap_one_built_in_call (gimple bi_call) wrapping transformation. */ static bool -shrink_wrap_conditional_dead_built_in_calls (void) +shrink_wrap_conditional_dead_built_in_calls (VEC (gimple, heap) *calls) { bool changed = false; unsigned i = 0; - unsigned n = VEC_length (gimple, cond_dead_built_in_calls); + unsigned n = VEC_length (gimple, calls); if (n == 0) return false; for (; i < n ; i++) { - gimple bi_call = VEC_index (gimple, cond_dead_built_in_calls, i); + gimple bi_call = VEC_index (gimple, calls, i); changed |= shrink_wrap_one_built_in_call (bi_call); } @@ -870,8 +868,7 @@ tree_call_cdce (void) basic_block bb; gimple_stmt_iterator i; bool something_changed = false; - cond_dead_built_in_calls = VEC_alloc (gimple, heap, 64); - + VEC (gimple, heap) *cond_dead_built_in_calls = NULL; FOR_EACH_BB (bb) { /* Collect dead call candidates. */ @@ -887,12 +884,18 @@ tree_call_cdce (void) print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM); fprintf (dump_file, "\n"); } - VEC_quick_push (gimple, cond_dead_built_in_calls, stmt); + if (cond_dead_built_in_calls == NULL) + cond_dead_built_in_calls = VEC_alloc (gimple, heap, 64); + VEC_safe_push (gimple, heap, cond_dead_built_in_calls, stmt); } } } - something_changed = shrink_wrap_conditional_dead_built_in_calls (); + if (cond_dead_built_in_calls == NULL) + return 0; + + something_changed + = shrink_wrap_conditional_dead_built_in_calls (cond_dead_built_in_calls); VEC_free (gimple, heap, cond_dead_built_in_calls);