diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr103253.c | 16 | ||||
-rw-r--r-- | gcc/tree-ssa-math-opts.c | 4 |
2 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/pr103253.c b/gcc/testsuite/gcc.dg/vect/pr103253.c new file mode 100644 index 0000000..abe3f09 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr103253.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target fopenmp } */ +/* { dg-additional-options "-O2 -fexceptions -fopenmp -fno-delete-dead-exceptions -fno-trapping-math" } */ + +double +do_work (double do_work_pri) +{ + int i; + +#pragma omp simd + for (i = 0; i < 17; ++i) + do_work_pri = (!i ? 0.5 : i) * 2.0; + + return do_work_pri; +} + diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index c4a6492..cc8496c 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -3224,6 +3224,10 @@ convert_mult_to_fma (gimple *mul_stmt, tree op1, tree op2, fma_deferring_state *state, tree mul_cond = NULL_TREE) { tree mul_result = gimple_get_lhs (mul_stmt); + /* If there isn't a LHS then this can't be an FMA. There can be no LHS + if the statement was left just for the side-effects. */ + if (!mul_result) + return false; tree type = TREE_TYPE (mul_result); gimple *use_stmt, *neguse_stmt; use_operand_p use_p; |