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
 2016-01-01  Jakub Jelinek  <jakub@redhat.com>
 
+       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.
 
 2016-01-01  Jakub Jelinek  <jakub@redhat.com>
 
+       PR tree-optimization/69070
+       * gcc.dg/pr69070.c: New test.
+
        PR sanitizer/69055
        * gfortran.dg/pr69055.f90: New test.
 
 
--- /dev/null
+/* PR tree-optimization/69070 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fsignaling-nans" } */
+
+double
+foo (double d)
+{
+  return __builtin_pow (d, 2);
+}
 
   /* 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;