From: Jakub Jelinek Date: Fri, 1 Jan 2016 11:55:59 +0000 (+0100) Subject: re PR tree-optimization/69070 (ICE: tree check: expected real_cst, have ssa_name... X-Git-Tag: basepoints/gcc-7~1856 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=942a13194f3efa752dbb1d9b8fbe6ceb9d104e13;p=thirdparty%2Fgcc.git re PR tree-optimization/69070 (ICE: tree check: expected real_cst, have ssa_name in gimple_expand_builtin_pow, at tree-ssa-math-opts.c:1541 with -fsignaling-nans and powl()) PR tree-optimization/69070 * tree-ssa-math-opts.c (gimple_expand_builtin_pow): Only test REAL_VALUE_ISSIGNALING_NAN on arg0 if arg0 is a REAL_CST. * gcc.dg/pr69070.c: New test. From-SVN: r232025 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8f67593969f8..7d27a8341305 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2016-01-01 Jakub Jelinek + PR tree-optimization/69070 + * tree-ssa-math-opts.c (gimple_expand_builtin_pow): Only test + REAL_VALUE_ISSIGNALING_NAN on arg0 if arg0 is a REAL_CST. + PR sanitizer/69055 * ubsan.c (ubsan_instrument_float_cast): Call initialize_sanitizer_builtins. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3de98fbbca15..e189d4b838aa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2016-01-01 Jakub Jelinek + PR tree-optimization/69070 + * gcc.dg/pr69070.c: New test. + PR sanitizer/69055 * gfortran.dg/pr69055.f90: New test. diff --git a/gcc/testsuite/gcc.dg/pr69070.c b/gcc/testsuite/gcc.dg/pr69070.c new file mode 100644 index 000000000000..f8a82e5cd1dc --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr69070.c @@ -0,0 +1,9 @@ +/* PR tree-optimization/69070 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fsignaling-nans" } */ + +double +foo (double d) +{ + return __builtin_pow (d, 2); +} diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index 244cf1962777..5cb8ba2275c8 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -1538,7 +1538,8 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *gsi, location_t loc, /* Don't perform the operation if flag_signaling_nans is on and the operand is a signaling NaN. */ if (HONOR_SNANS (TYPE_MODE (TREE_TYPE (arg1))) - && (REAL_VALUE_ISSIGNALING_NAN (TREE_REAL_CST (arg0)) + && ((TREE_CODE (arg0) == REAL_CST + && REAL_VALUE_ISSIGNALING_NAN (TREE_REAL_CST (arg0))) || REAL_VALUE_ISSIGNALING_NAN (TREE_REAL_CST (arg1)))) return NULL_TREE;