re PR tree-optimization/36339 (not call clobbering variable for non common offset)
authorRichard Guenther <rguenther@suse.de>
Tue, 27 May 2008 13:21:07 +0000 (13:21 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 27 May 2008 13:21:07 +0000 (13:21 +0000)
2008-05-27  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/36339
* tree-ssa-alias.c (set_initial_properties): Escaped pt_anything
pointers cause all addressable variables to be call clobbered.

* gcc.c-torture/execute/pr36339.c: New testcase.
* gcc.dg/tree-ssa/loadpre8.c: XFAIL.

From-SVN: r136030

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pr36339.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/loadpre8.c
gcc/tree-ssa-alias.c

index bbe6eec73f85e9ace6ba4cfec6ca523746d4053f..b0ccae4f652e0331b301d1369e31942713b38a84 100644 (file)
@@ -1,3 +1,9 @@
+2008-05-27  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/36339
+       * tree-ssa-alias.c (set_initial_properties): Escaped pt_anything
+       pointers cause all addressable variables to be call clobbered.
+
 2008-05-27  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/36245
index d1eb120f035be0e4915c02cd048e93929f1b0a36..815ab8aca1081cab62d65dd97a43bd7a49a210fa 100644 (file)
@@ -1,3 +1,9 @@
+2008-05-27  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/36339
+       * gcc.c-torture/execute/pr36339.c: New testcase.
+       * gcc.dg/tree-ssa/loadpre8.c: XFAIL.
+
 2008-05-27  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/pack9.ad[sb]: New test.
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr36339.c b/gcc/testsuite/gcc.c-torture/execute/pr36339.c
new file mode 100644 (file)
index 0000000..c4f36dd
--- /dev/null
@@ -0,0 +1,32 @@
+extern void abort (void);
+
+typedef unsigned long my_uintptr_t;
+
+int check_a(my_uintptr_t tagged_ptr);
+
+int __attribute__((noinline)) try_a(my_uintptr_t x)
+{
+  my_uintptr_t heap[2];
+  my_uintptr_t *hp = heap;
+
+  hp[0] = x;
+  hp[1] = 0;
+  return check_a((my_uintptr_t)(void*)((char*)hp + 1));
+}
+
+int __attribute__((noinline)) check_a(my_uintptr_t tagged_ptr)
+{
+  my_uintptr_t *hp = (my_uintptr_t*)(void*)((char*)tagged_ptr - 1);
+
+  if (hp[0] == 42 && hp[1] == 0)
+    return 0;
+  return -1;
+}
+
+int main(void)
+{
+  if (try_a(42) < 0)
+    abort ();
+  return 0;
+}
+
index a4d2e50c461b71a3bc47ce75a4ebd5ca8f3951c9..6be2b3ec7fd798af57e7d00cc2a46a323fc0a092 100644 (file)
@@ -93,5 +93,5 @@ rewrite_add_phi_arguments (basic_block bb)
          get_reaching_def ((get_def_from_ptr (get_phi_result_ptr (phi)))->ssa_name.var);
     }
 }
-/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */
+/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre" { xfail *-*-* } } } */
 /* { dg-final { cleanup-tree-dump "pre" } } */
index 7ce016b90962d697bf2b3b7e2a1a439fa09f24e3..983e321521d313270a1f29584ebcc6b2b71dc70d 100644 (file)
@@ -571,6 +571,22 @@ set_initial_properties (struct alias_info *ai)
                    mark_call_clobbered (alias, pi->escape_mask);
                }
            }
+         else if (pi->pt_anything)
+           {
+             bitmap_iterator bi;
+             unsigned int j;
+
+             /* If we do not have the points-to set filled out we
+                still need to honor that this escaped pointer points
+                to anything.  */
+             EXECUTE_IF_SET_IN_BITMAP (gimple_addressable_vars (cfun),
+                                       0, j, bi)
+               {
+                 tree var = referenced_var (j);
+                 if (!unmodifiable_var_p (var))
+                   mark_call_clobbered (var, pi->escape_mask);
+               }
+           }
        }
 
       /* If the name tag is call clobbered, so is the symbol tag