fold-const.c (tree_expr_nonnegative_p): Always return true for non-integral types.
authorJames A. Morrison <phython@gcc.gnu.org>
Sat, 30 Jul 2005 14:39:12 +0000 (14:39 +0000)
committerJames A. Morrison <phython@gcc.gnu.org>
Sat, 30 Jul 2005 14:39:12 +0000 (14:39 +0000)
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

gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/fold-abs-4.c [new file with mode: 0644]

index ae5288e..f9b52d0 100644 (file)
@@ -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
index a2d6250..d27eeb0 100644 (file)
@@ -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;
 
index ec62a95..2980e1c 100644 (file)
@@ -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 (file)
index 0000000..8bf02a8
--- /dev/null
@@ -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" } } */