]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR tree-optimization/55022 (air.f90 is miscompliled with -m64 -O2 -fgrap...
authorRichard Biener <rguenther@suse.de>
Tue, 6 May 2014 12:01:21 +0000 (12:01 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 6 May 2014 12:01:21 +0000 (12:01 +0000)
2014-05-06  Richard Biener  <rguenther@suse.de>

Backport from mainline
2014-04-14  Richard Biener  <rguenther@suse.de>

PR middle-end/55022
* fold-const.c (negate_expr_p): Don't negate directional rounding
division.
(fold_negate_expr): Likewise.

* gcc.dg/graphite/pr55022.c: New testcase.

From-SVN: r210104

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

index b70d476113b88a57f5ca791bffeb47f293420f1b..e9c0b4f57d2b9f0a75666a7b5e28b6ed81099c3e 100644 (file)
@@ -1,3 +1,13 @@
+2014-05-06  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2014-04-14  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/55022
+       * fold-const.c (negate_expr_p): Don't negate directional rounding
+       division.
+       (fold_negate_expr): Likewise.
+
 2014-05-06  Richard Biener  <rguenther@suse.de>
 
        Backport from mainline
index b4ff75e5d9821ea8d29395e58fa188a04f9fcd29..3a60201e22447748119f9c5b35030b29f1c22a1d 100644 (file)
@@ -461,8 +461,6 @@ negate_expr_p (tree t)
 
     case TRUNC_DIV_EXPR:
     case ROUND_DIV_EXPR:
-    case FLOOR_DIV_EXPR:
-    case CEIL_DIV_EXPR:
     case EXACT_DIV_EXPR:
       /* In general we can't negate A / B, because if A is INT_MIN and
         B is 1, we may turn this into INT_MIN / -1 which is undefined
@@ -644,8 +642,6 @@ fold_negate_expr (location_t loc, tree t)
 
     case TRUNC_DIV_EXPR:
     case ROUND_DIV_EXPR:
-    case FLOOR_DIV_EXPR:
-    case CEIL_DIV_EXPR:
     case EXACT_DIV_EXPR:
       /* In general we can't negate A / B, because if A is INT_MIN and
         B is 1, we may turn this into INT_MIN / -1 which is undefined
index a81e46eee898153d0e27ec90cc390db26ccdda52..a74b5e5e09d008172892fcb53b2e442a6cc92e82 100644 (file)
@@ -1,3 +1,11 @@
+2014-05-06  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2014-04-14  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/55022
+       * gcc.dg/graphite/pr55022.c: New testcase.
+
 2014-05-06  Richard Biener  <rguenther@suse.de>
 
        Backport from mainline
diff --git a/gcc/testsuite/gcc.dg/graphite/pr55022.c b/gcc/testsuite/gcc.dg/graphite/pr55022.c
new file mode 100644 (file)
index 0000000..c631c0e
--- /dev/null
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fgraphite-identity" } */
+
+extern void abort (void);
+
+void __attribute__((noinline,noclone))
+f(int *limit, int minLen, int maxLen)
+{
+  int i;
+
+  for (i = minLen; i <= maxLen; i++) {
+      limit[i] = i;
+  }
+}
+
+int main()
+{
+  int limit[256], i;
+  f (limit, 0, 255);
+  for (i = 0; i < 256; ++i)
+    {
+      if (limit[i] != i)
+       abort ();
+      __asm__ volatile ("" : : : "memory");
+    }
+  return 0;
+}