]> git.pld-linux.org Git - packages/gcc.git/commitdiff
- fix detection of overflow from multiply expressions. auto/th/gcc-4_1_1-0_20060501r113407_4
authorPaweł Sikora <pluto@pld-linux.org>
Tue, 2 May 2006 21:04:49 +0000 (21:04 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    gcc-pr27364.patch -> 1.1.2.1
    gcc.spec -> 1.396.2.54

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

diff --git a/gcc-pr27364.patch b/gcc-pr27364.patch
new file mode 100644 (file)
index 0000000..b82089f
--- /dev/null
@@ -0,0 +1,47 @@
+       PR tree-optimization/27364
+       * tree-vrp.c (vrp_int_const_binop): Fix detection of overflow from
+       multiply expressions.
+
+--- gcc-4_1-branch/gcc/tree-vrp.c.orig 2006-02-10 09:46:43.000000000 +0100
++++ gcc-4_1-branch/gcc/tree-vrp.c      2006-05-02 22:59:17.000000000 +0200
+@@ -1101,17 +1101,39 @@
+   if (TYPE_UNSIGNED (TREE_TYPE (val1)))
+     {
+       int checkz = compare_values (res, val1);
++      bool overflow = false;
+       /* Ensure that res = val1 [+*] val2 >= val1
+          or that res = val1 - val2 <= val1.  */
+-      if (((code == PLUS_EXPR || code == MULT_EXPR)
++      if ((code == PLUS_EXPR
+          && !(checkz == 1 || checkz == 0))
+           || (code == MINUS_EXPR
+             && !(checkz == 0 || checkz == -1)))
+       {
++        overflow = true;
++      }
++      /* Checking for multiplication overflow is done by dividing the
++       output of the multiplication by the first input of the
++       multiplication.  If the result of that division operation is
++       not equal to the second input of the multiplication, then the
++       multiplication overflowed.  */
++      else if (code == MULT_EXPR && !integer_zerop (val1))
++      {
++        tree tmp = int_const_binop (TRUNC_DIV_EXPR,
++                                    TYPE_MAX_VALUE (TREE_TYPE (val1)),
++                                    val1, 0);
++        int check = compare_values (tmp, val2);
++
++        if (check != 0)
++          overflow = true;
++      }
++
++      if (overflow)
++      {
+         res = copy_node (res);
+         TREE_OVERFLOW (res) = 1;
+       }
++
+     }
+   else if (TREE_OVERFLOW (res)
+          && !TREE_OVERFLOW (val1)
index 0ef92d37707540368f85fd0115d5f93bf0b90579..f66bd1833415f4ef37da89c4ca2cd3878e7f9e06 100644 (file)
--- a/gcc.spec
+++ b/gcc.spec
@@ -35,7 +35,7 @@ Summary(pt_BR):       Cole
 Name:          gcc
 Version:       4.1.1
 %define                _snap   20060501r113407
-Release:       0.%{_snap}.3
+Release:       0.%{_snap}.4
 #Release:      2
 Epoch:         5
 License:       GPL v2+
@@ -63,6 +63,7 @@ Patch11:      %{name}-pr26565.patch
 Patch12:       %{name}-pr19606.patch
 Patch13:       %{name}-pr24879.patch
 Patch14:       %{name}-pr26912.patch
+Patch15:       %{name}-pr27364.patch
 
 Patch17:       %{name}-pr19505.patch
 Patch18:       %{name}-pr24419.patch
@@ -778,6 +779,7 @@ Statyczne biblioteki Obiektowego C.
 %patch12 -p0
 %patch13 -p0
 %patch14 -p1
+%patch15 -p1
 
 %patch17 -p1
 %patch18 -p1
This page took 0.11401 seconds and 4 git commands to generate.