diff options
author | Zdenek Dvorak <dvorakz@suse.cz> | 2006-11-23 00:11:15 +0100 |
---|---|---|
committer | Zdenek Dvorak <rakdver@gcc.gnu.org> | 2006-11-22 23:11:15 +0000 |
commit | 0446c9f3a7f86ed71112170e8e9023d3ac526dde (patch) | |
tree | 466302702261d13e0284a991a22c4b62dc8aa24f /gcc | |
parent | cbad228156007fa24dda35b0a479b751ee12c9d2 (diff) | |
download | gcc-0446c9f3a7f86ed71112170e8e9023d3ac526dde.zip gcc-0446c9f3a7f86ed71112170e8e9023d3ac526dde.tar.gz gcc-0446c9f3a7f86ed71112170e8e9023d3ac526dde.tar.bz2 |
re PR tree-optimization/29921 (internal compiler error: in set_lattice_value, at tree-ssa-ccp.c:437)
PR tree-optimization/29921
* fold-const.c (operand_equal_p): Without HONOR_SIGNED_ZEROS, consider
signed and unsigned zero equal.
* gcc.dg/pr29921.c: New test.
From-SVN: r119102
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fold-const.c | 15 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr29921.c | 20 |
4 files changed, 44 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c6fdb9f..5bb0ce3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2006-11-23 Zdenek Dvorak <dvorakz@suse.cz> + + PR tree-optimization/29921 + * fold-const.c (operand_equal_p): Without HONOR_SIGNED_ZEROS, consider + signed and unsigned zero equal. + 2006-11-22 Peter Bergner <bergner@vnet.ibm.com> * config/rs6000/rs6000.c (get_store_dest): New. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index cd7f1d9..b19b768 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -2584,8 +2584,19 @@ operand_equal_p (tree arg0, tree arg1, unsigned int flags) return tree_int_cst_equal (arg0, arg1); case REAL_CST: - return REAL_VALUES_IDENTICAL (TREE_REAL_CST (arg0), - TREE_REAL_CST (arg1)); + if (REAL_VALUES_IDENTICAL (TREE_REAL_CST (arg0), + TREE_REAL_CST (arg1))) + return 1; + + + if (!HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (arg0)))) + { + /* If we do not distinguish between signed and unsigned zero, + consider them equal. */ + if (real_zerop (arg0) && real_zerop (arg1)) + return 1; + } + return 0; case VECTOR_CST: { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ff2a80d..f8dc647 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-11-23 Zdenek Dvorak <dvorakz@suse.cz> + + PR tree-optimization/29921 + * gcc.dg/pr29921.c: New test. + 2006-11-22 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de> PR fortran/29441 diff --git a/gcc/testsuite/gcc.dg/pr29921.c b/gcc/testsuite/gcc.dg/pr29921.c new file mode 100644 index 0000000..7689f54 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr29921.c @@ -0,0 +1,20 @@ +/* With -ffast-math, the latice value for t changes from -0.0 to 0.0 in this + testcase. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -ffast-math" } */ + +double test (int param) +{ + double a = 0.0, b = -1.0, t; + int i; + + for (i = 0; i < 100; i++) + { + t = a * b; + if (param) + b = 2.0; + } + + return t; +} |