From 87ebde38c04dcb4511e6081e916a6c910ae39e8d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 30 Dec 2010 09:24:58 +0100 Subject: [PATCH] re PR tree-optimization/47060 (ICE: SIGSEGV in reduction_phi (tree-parloops.c:212) with -O -ffast-math -ftree-parallelize-loops=2 -fno-tree-dce) PR tree-optimization/47060 * tree-parloops.c (reduction_phi): Return NULL if PHI is NULL. * gcc.dg/autopar/pr47060.c: New test. From-SVN: r168336 --- gcc/ChangeLog | 5 +++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/autopar/pr47060.c | 21 +++++++++++++++++++++ gcc/tree-parloops.c | 2 +- 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/autopar/pr47060.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4f29072a00d..067ed753a82 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2010-12-30 Jakub Jelinek + + PR tree-optimization/47060 + * tree-parloops.c (reduction_phi): Return NULL if PHI is NULL. + 2010-12-29 Paul Koning * config/pdp11/pdp11-protos.h (pdp11_asm_output_var): Declare. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a364a4e64ff..43b5afb6c39 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-12-30 Jakub Jelinek + + PR tree-optimization/47060 + * gcc.dg/autopar/pr47060.c: New test. + 2010-12-30 Nicola Pero * objc.dg/enhanced-proto-2.m: Updated. diff --git a/gcc/testsuite/gcc.dg/autopar/pr47060.c b/gcc/testsuite/gcc.dg/autopar/pr47060.c new file mode 100644 index 00000000000..e8cdfd6677e --- /dev/null +++ b/gcc/testsuite/gcc.dg/autopar/pr47060.c @@ -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; +} diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index 9ece8879e2e..96759cbfe89 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -201,7 +201,7 @@ reduction_phi (htab_t reduction_list, gimple phi) { 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; -- 2.30.2