diff options
author | Daniel Jacobowitz <dan@codesourcery.com> | 2008-10-02 15:15:40 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@gcc.gnu.org> | 2008-10-02 15:15:40 +0000 |
commit | 17372f8cc5e934f5257ab4fdac888632b4aaf12a (patch) | |
tree | f5bcc742c5aec9c5856707c4ba3527bb4cde8eb3 /gcc/builtins.c | |
parent | 0d17b70a0a09f15f0465de7d8717d5eba8d224d2 (diff) | |
download | gcc-17372f8cc5e934f5257ab4fdac888632b4aaf12a.zip gcc-17372f8cc5e934f5257ab4fdac888632b4aaf12a.tar.gz gcc-17372f8cc5e934f5257ab4fdac888632b4aaf12a.tar.bz2 |
* builtins.c (fold_builtin_pow): Check for 0 ** NEGATIVE.
From-SVN: r140833
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 81d0ab1..ea1a16d 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; |