]> git.pld-linux.org Git - packages/gcc.git/commitdiff
- critical bugfix. auto/th/gcc-4_1_0-0_20050815T0803UTC_2
authorPaweł Sikora <pluto@pld-linux.org>
Mon, 15 Aug 2005 08:00:13 +0000 (08:00 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    gcc-pr23386.patch -> 1.1

gcc-pr23386.patch [new file with mode: 0644]

diff --git a/gcc-pr23386.patch b/gcc-pr23386.patch
new file mode 100644 (file)
index 0000000..37d1375
--- /dev/null
@@ -0,0 +1,44 @@
+--- gcc/gcc/tree-data-ref.c    2005/08/14 06:28:03     2.37
++++ gcc/gcc/tree-data-ref.c    2005/08/15 07:51:39     2.38
+@@ -751,7 +751,7 @@
+                                 tree access_fn, 
+                                 tree stmt)
+ {
+-  tree estimation;
++  tree estimation = NULL_TREE;
+   tree array_size, data_size, element_size;
+   tree init, step;
+@@ -773,11 +773,28 @@
+       && TREE_CODE (init) == INTEGER_CST
+       && TREE_CODE (step) == INTEGER_CST)
+     {
+-      estimation = fold_build2 (CEIL_DIV_EXPR, integer_type_node,
+-                              fold_build2 (MINUS_EXPR, integer_type_node,
+-                                           data_size, init), step);
++      tree i_plus_s = fold_build2 (PLUS_EXPR, integer_type_node, init, step);
++      tree sign = fold_build2 (GT_EXPR, boolean_type_node, i_plus_s, init);
+-      record_estimate (loop, estimation, boolean_true_node, stmt);
++      if (sign == boolean_true_node)
++      estimation = fold_build2 (CEIL_DIV_EXPR, integer_type_node,
++                                fold_build2 (MINUS_EXPR, integer_type_node,
++                                             data_size, init), step);
++
++      /* When the step is negative, as in PR23386: (init = 3, step =
++       0ffffffff, data_size = 100), we have to compute the
++       estimation as ceil_div (init, 0 - step) + 1.  */
++      else if (sign == boolean_false_node)
++      estimation = 
++        fold_build2 (PLUS_EXPR, integer_type_node,
++                     fold_build2 (CEIL_DIV_EXPR, integer_type_node,
++                                  init,
++                                  fold_build2 (MINUS_EXPR, unsigned_type_node,
++                                               integer_zero_node, step)),
++                     integer_one_node);
++
++      if (estimation)
++      record_estimate (loop, estimation, boolean_true_node, stmt);
+     }
+ }
This page took 0.034076 seconds and 4 git commands to generate.