aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2006-10-11 16:05:37 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2006-10-11 16:05:37 +0000
commit377d569bdb93c48ccb209288dbddf0625e9ee335 (patch)
treed54ada4cbde7ded1a040c5e4405cf669b2b3c13c /gcc
parentd233eb7a05ca704c3d220a555e94c04fa328aee6 (diff)
downloadgcc-377d569bdb93c48ccb209288dbddf0625e9ee335.zip
gcc-377d569bdb93c48ccb209288dbddf0625e9ee335.tar.gz
gcc-377d569bdb93c48ccb209288dbddf0625e9ee335.tar.bz2
re PR tree-optimization/28230 (-O2 -fwrapv miscompiles gcc, binutils, gzip.)
2006-10-11 Richard Guenther <rguenther@suse.de> PR tree-optimization/28230 * tree-vrp.c (vrp_int_const_binop): Move flag_wrapv handling to the correct place. * gcc.dg/torture/pr28230.c: New testcase. From-SVN: r117637
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr28230.c20
-rw-r--r--gcc/tree-vrp.c8
4 files changed, 34 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8eca250..6fd39c7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2006-10-11 Richard Guenther <rguenther@suse.de>
+ PR tree-optimization/28230
+ * tree-vrp.c (vrp_int_const_binop): Move flag_wrapv handling
+ to the correct place.
+
+2006-10-11 Richard Guenther <rguenther@suse.de>
+
PR inline-asm/29119
* gimplify.c (gimplify_asm_expr): Mark the gimplified lvalue
addressable.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c9b7c54..aa9cd9e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2006-10-11 Richard Guenther <rguenther@suse.de>
+ PR tree-optimization/28230
+ * gcc.dg/torture/pr28230.c: New testcase.
+
+2006-10-11 Richard Guenther <rguenther@suse.de>
+
PR inline-asm/29119
* gcc.dg/torture/pr29119.c: New testcase.
diff --git a/gcc/testsuite/gcc.dg/torture/pr28230.c b/gcc/testsuite/gcc.dg/torture/pr28230.c
new file mode 100644
index 0000000..5ecc0c7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr28230.c
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+/* { dg-options "-fwrapv" } */
+
+void foo( unsigned long long bb, unsigned short tn, unsigned e, unsigned* w );
+void foo( unsigned long long bb, unsigned short tn, unsigned e, unsigned* w )
+{
+ unsigned n = tn + bb;
+ do {
+ e = (e > n) ? e : *w;
+ n -= (e > n) ? n : e;
+ if (*w)
+ *w = 0;
+ } while ( n );
+}
+int main()
+{
+ unsigned w = 0;
+ foo( 0, 0, 0, &w );
+ return 0;
+}
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index a212744..4a30e4e 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -1235,14 +1235,12 @@ vrp_int_const_binop (enum tree_code code, tree val1, tree val2)
{
tree res;
- if (flag_wrapv)
- return int_const_binop (code, val1, val2, 0);
+ res = int_const_binop (code, val1, val2, 0);
/* If we are not using wrapping arithmetic, operate symbolically
on -INF and +INF. */
- res = int_const_binop (code, val1, val2, 0);
-
- if (TYPE_UNSIGNED (TREE_TYPE (val1)))
+ if (TYPE_UNSIGNED (TREE_TYPE (val1))
+ || flag_wrapv)
{
int checkz = compare_values (res, val1);
bool overflow = false;