From c2bed4327c2dd27b87518532d417674d4edcc9c7 Mon Sep 17 00:00:00 2001 From: dberlin Date: Mon, 29 Jan 2007 17:25:04 +0000 Subject: [PATCH] 2007-01-29 Daniel Berlin PR tree-optimization/30630 * tree-ssa-structalias.c (do_complex_constraint): Mark correct variable as changed. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121295 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++ gcc/testsuite/gcc.c-torture/compile/20070129.c | 94 ++++++++++++++++++++++++++ gcc/tree-ssa-structalias.c | 5 +- 3 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/20070129.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9e4d1c4..a733865 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2007-01-29 Daniel Berlin + + PR tree-optimization/30630 + * tree-ssa-structalias.c (do_complex_constraint): Mark correct + variable as changed. + 2007-01-29 Simon Martin PR c++/28266 diff --git a/gcc/testsuite/gcc.c-torture/compile/20070129.c b/gcc/testsuite/gcc.c-torture/compile/20070129.c new file mode 100644 index 0000000..3204d96 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20070129.c @@ -0,0 +1,94 @@ +/* This testcase would cause a hang in PTA solving due to a complex copy + constraint and marking the wrong variable as changed. */ + +typedef struct RExC_state_t +{ + char *end; + char *parse; +} RExC_state_t; + +struct regnode_string +{ + unsigned char str_len; + char string[1]; +}; + +static void *regatom (RExC_state_t * pRExC_state, int *flagp); + +static void * +regpiece (RExC_state_t * pRExC_state, int *flagp) +{ + return regatom (0, 0); +} + +static void * +regbranch (RExC_state_t * pRExC_state, int *flagp, int first) +{ + return regpiece (0, 0); +} + +static void * +reg (RExC_state_t * pRExC_state, int paren, int *flagp) +{ + return regbranch (0, 0, 1); +} + +void * +Perl_pregcomp (char *exp, char *xend, void *pm) +{ + return reg (0, 0, 0); +} + +static void * +regatom (RExC_state_t * pRExC_state, int *flagp) +{ + register void *ret = 0; + int flags; + +tryagain: + switch (*(pRExC_state->parse)) + { + case '(': + ret = reg (pRExC_state, 1, &flags); + if (flags & 0x8) + { + goto tryagain; + } + break; + default: + { + register unsigned long len; + register unsigned ender; + register char *p; + char *oldp, *s; + unsigned long numlen; + unsigned long foldlen; + unsigned char tmpbuf[6 + 1], *foldbuf; + + defchar: + s = (((struct regnode_string *) ret)->string); + for (len = 0, p = (pRExC_state->parse) - 1; + len < 127 && p < (pRExC_state->end); len++) + { + if (((*p) == '*' || (*p) == '+' || (*p) == '?' + || ((*p) == '{' && regcurly (p)))) + { + unsigned long unilen; + for (foldbuf = tmpbuf; foldlen; foldlen -= numlen) + { + reguni (pRExC_state, ender, s, &unilen); + s += unilen; + } + break; + } + unsigned long unilen; + + reguni (pRExC_state, ender, s, &unilen); + s += unilen; + } + + }; + break; + } + return (ret); +} diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index dd95c9f..c57f1c2 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -1538,9 +1538,9 @@ do_complex_constraint (constraint_graph_t graph, constraint_t c, bitmap delta) if (flag) { get_varinfo (t)->solution = tmp; - if (!TEST_BIT (changed, c->lhs.var)) + if (!TEST_BIT (changed, t)) { - SET_BIT (changed, c->lhs.var); + SET_BIT (changed, t); changed_count++; } } @@ -2065,6 +2065,7 @@ solve_graph (constraint_graph_t graph) bitmap solution; VEC(constraint_t,heap) *complex = graph->complex[i]; bool solution_empty; + RESET_BIT (changed, i); changed_count--; -- 2.7.4