This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi! Before my recent tree-parloops.c fixes reduction_phi would return NULL if phi was NULL and the callers were relying on that in some cases, as shown on the testcase. Calling gimple_uid on it will segfault though, so the following patch checks for that explicitly. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2010-12-29 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/47060 * tree-parloops.c (reduction_phi): Return NULL if PHI is NULL. * gcc.dg/autopar/pr47060.c: New test. --- gcc/tree-parloops.c.jj 2010-12-28 12:33:08.000000000 +0100 +++ gcc/tree-parloops.c 2010-12-29 20:37:38.000000000 +0100 @@ -205,7 +205,7 @@ reduction_phi (htab_t reduction_list, gi { struct reduction_info tmpred, *red; - if (htab_elements (reduction_list) == 0) + if (htab_elements (reduction_list) == 0 || phi == NULL) return NULL; tmpred.reduc_phi = phi; --- gcc/testsuite/gcc.dg/autopar/pr47060.c.jj 2010-12-29 20:36:02.000000000 +0100 +++ gcc/testsuite/gcc.dg/autopar/pr47060.c 2010-12-29 20:35:23.000000000 +0100 @@ -0,0 +1,21 @@ +/* PR tree-optimization/47060 */ +/* { dg-do compile } */ +/* { dg-options "-O -ffast-math -ftree-parallelize-loops=2 -fno-tree-dce" } */ + +struct S +{ + int n; + float *a; +}; + +float +foo (struct S *b) +{ + float c, d; + int j; + for (j = 0; j < b->n; j++) + d += b->a[j]; + for (j = 0; j < b->n; j++) + c += b->a[j]; + return d; +} Jakub
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |