]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/39233 (ivopts + vrp miscompilation)
authorRichard Guenther <rguenther@suse.de>
Tue, 24 Feb 2009 11:05:15 +0000 (11:05 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 24 Feb 2009 11:05:15 +0000 (11:05 +0000)
2009-02-24  Richard Guenther  <rguenther@suse.de>
Zdenek Dvorak  <ook@ucw.cz>

PR tree-optimization/39233
* tree-ssa-loop-ivopts.c (add_candidate_1): Do not except pointers
from converting them to a generic type.

* gcc.c-torture/execute/pr39233.c: New testcase.

Co-Authored-By: Zdenek Dvorak <ook@ucw.cz>
From-SVN: r144405

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pr39233.c [new file with mode: 0644]
gcc/tree-ssa-loop-ivopts.c

index 19104625f6cdf9c1122c780d236f6d4a8c5ad257..c89a3f473377f57a7c60eecdf462535bb2ba1760 100644 (file)
@@ -1,3 +1,10 @@
+2009-02-24  Richard Guenther  <rguenther@suse.de>
+       Zdenek Dvorak  <ook@ucw.cz>
+
+       PR tree-optimization/39233
+       * tree-ssa-loop-ivopts.c (add_candidate_1): Do not except pointers
+       from converting them to a generic type.
+
 2009-02-23  Sebastian Pop  <sebastian.pop@amd.com>
 
        PR tree-optimization/39260
index 4256418d318d8303ee8e70719d73e30bdf5a92f0..4af6e1843628acb74511ed3fd012d38a41fd48e5 100644 (file)
@@ -1,3 +1,9 @@
+2009-02-24  Richard Guenther  <rguenther@suse.de>
+       Zdenek Dvorak  <ook@ucw.cz>
+
+       PR tree-optimization/39233
+       * gcc.c-torture/execute/pr39233.c: New testcase.
+
 2009-02-23  Sebastian Pop  <sebastian.pop@amd.com>
 
        PR tree-optimization/39260
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr39233.c b/gcc/testsuite/gcc.c-torture/execute/pr39233.c
new file mode 100644 (file)
index 0000000..29f7223
--- /dev/null
@@ -0,0 +1,18 @@
+extern void abort (void);
+
+__attribute__((noinline)) void
+foo (void *p)
+{
+  long l = (long) p;
+  if (l < 0 || l > 6)
+    abort ();
+}
+
+int
+main ()
+{
+  short i;
+  for (i = 6; i >= 0; i--)
+    foo ((void *) (long) i);
+  return 0;
+}
index ca1ab98b85af6b6879918cad08ccf93c494d7e3b..b1813d373dc43ba966753d5756d86556a059aa80 100644 (file)
@@ -2071,9 +2071,7 @@ add_candidate_1 (struct ivopts_data *data,
     {
       orig_type = TREE_TYPE (base);
       type = generic_type_for (orig_type);
-      /* Don't convert the base to the generic type for pointers as the generic
-        type is an integer type with the same size as the pointer type.  */
-      if (type != orig_type && !POINTER_TYPE_P (orig_type))
+      if (type != orig_type)
        {
          base = fold_convert (type, base);
          step = fold_convert (type, step);