aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames A. Morrison <phython@gcc.gnu.org>2005-07-30 14:39:12 +0000
committerJames A. Morrison <phython@gcc.gnu.org>2005-07-30 14:39:12 +0000
commit06581725b92dd7808e1388950b9bb90d095d2315 (patch)
tree0c3a0a572c1ea7eba687ff1b66b148d64008b191
parentb6f571b7d3f815d36a5c6a6d91c9e6c87b824206 (diff)
downloadgcc-06581725b92dd7808e1388950b9bb90d095d2315.zip
gcc-06581725b92dd7808e1388950b9bb90d095d2315.tar.gz
gcc-06581725b92dd7808e1388950b9bb90d095d2315.tar.bz2
fold-const.c (tree_expr_nonnegative_p): Always return true for non-integral types.
2005-07-30 James A. Morrison <phython@gcc.gnu.org> * fold-const.c (tree_expr_nonnegative_p): Always return true for non-integral types. From-SVN: r102587
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/fold-const.c2
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/fold-abs-4.c15
4 files changed, 26 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ae5288e..f9b52d0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2005-07-30 James A. Morrison <phython@gcc.gnu.org>
+
+ * fold-const.c (tree_expr_nonnegative_p): Always return true for
+ non-integral types.
+
2005-07-29 Wolfgang Bangerth <bangerth@dealii.org>
PR target/22582
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index a2d6250..d27eeb0 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -10719,7 +10719,7 @@ tree_expr_nonnegative_p (tree t)
case ABS_EXPR:
/* We can't return 1 if flag_wrapv is set because
ABS_EXPR<INT_MIN> = INT_MIN. */
- if (!flag_wrapv)
+ if (!(flag_wrapv && INTEGRAL_TYPE_P (TREE_TYPE (t))))
return 1;
break;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ec62a95..2980e1c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,4 +1,8 @@
-2005-07-30 Paul Thomas <pault@gcc.gnu.org>
+2005-07-30 James A. Morrison <phython@gcc.gnu.org>
+
+ * gcc.dg/fold-abs-4.c: new test.
+
+2005-07-30 Paul Thomas <pault@gcc.gnu.org>
PR fortran/22570 an related issues.
* gfortran.dg/x_slash_1.f: New test.
diff --git a/gcc/testsuite/gcc.dg/fold-abs-4.c b/gcc/testsuite/gcc.dg/fold-abs-4.c
new file mode 100644
index 0000000..8bf02a8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fold-abs-4.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-gimple -fwrapv" } */
+extern float fabsf (float);
+extern float cabsf (_Complex float);
+
+int f (float a) {
+ return fabsf(a) < 0.0;
+}
+
+int g (_Complex float a) {
+ return cabsf (a) < 0.0;
+}
+
+/* { dg-final { scan-tree-dump-times "ABS" 0 "gimple" } } */
+/* { dg-final { cleanup-tree-dump "gimple" } } */