]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* builtins.c (fold_builtin_pow): Check for 0 ** NEGATIVE.
authorDaniel Jacobowitz <dan@codesourcery.com>
Thu, 2 Oct 2008 15:15:40 +0000 (15:15 +0000)
committerDaniel Jacobowitz <drow@gcc.gnu.org>
Thu, 2 Oct 2008 15:15:40 +0000 (15:15 +0000)
From-SVN: r140833

gcc/ChangeLog
gcc/builtins.c

index e46778d7be16c79d7cfd7f512eb19caf055d68ac..b15180544cd70f6a08b02487a6395e0e6a34c27a 100644 (file)
@@ -1,3 +1,7 @@
+2008-10-02  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * builtins.c (fold_builtin_pow): Check for 0 ** NEGATIVE.
+
 2008-10-02  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/37713
index 81d0ab1dfa178f883ee06acaf43521f7e9e2f7d2..ea1a16d9bddb77d9b0a3a90244696761df34fda5 100644 (file)
@@ -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;