From: Daniel Jacobowitz Date: Thu, 2 Oct 2008 15:15:40 +0000 (+0000) Subject: * builtins.c (fold_builtin_pow): Check for 0 ** NEGATIVE. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=17372f8cc5e934f5257ab4fdac888632b4aaf12a;p=gcc.git * builtins.c (fold_builtin_pow): Check for 0 ** NEGATIVE. From-SVN: r140833 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e46778d7be1..b15180544cd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2008-10-02 Daniel Jacobowitz + + * builtins.c (fold_builtin_pow): Check for 0 ** NEGATIVE. + 2008-10-02 Richard Guenther PR middle-end/37713 diff --git a/gcc/builtins.c b/gcc/builtins.c index 81d0ab1dfa1..ea1a16d9bdd 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -8459,9 +8459,13 @@ fold_builtin_pow (tree fndecl, tree arg0, tree arg1, tree type) real_from_integer (&cint, VOIDmode, n, n < 0 ? -1 : 0, 0); if (real_identical (&c, &cint)) { - /* Attempt to evaluate pow at compile-time. */ + /* Attempt to evaluate pow at compile-time, unless this should + raise an exception. */ if (TREE_CODE (arg0) == REAL_CST - && !TREE_OVERFLOW (arg0)) + && !TREE_OVERFLOW (arg0) + && (n > 0 + || (!flag_trapping_math && !flag_errno_math) + || !REAL_VALUES_EQUAL (TREE_REAL_CST (arg0), dconst0))) { REAL_VALUE_TYPE x; bool inexact;