re PR tree-optimization/44050 (Wrong code is produced with -fipa-pta -fno-tree-pta)
authorRichard Guenther <rguenther@suse.de>
Mon, 10 May 2010 08:55:32 +0000 (08:55 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 10 May 2010 08:55:32 +0000 (08:55 +0000)
2010-05-10  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/44050
* tree-inline.c (tree_function_versioning): Clone the ipa-pta
flag.

* gcc.dg/torture/pr44050.c: New testcase.

From-SVN: r159214

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr44050.c [new file with mode: 0644]
gcc/tree-inline.c

index 76e6ea6931e262c2c7cf387ecf28a159916547a5..07c5dd790bd69c4ed1a65434b0f21813bfc0ab18 100644 (file)
@@ -1,3 +1,9 @@
+2010-05-10  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/44050
+       * tree-inline.c (tree_function_versioning): Clone the ipa-pta
+       flag.
+
 2010-05-10  Wei Guozhi  <carrot@google.com>
 
        PR target/42879
index 5ee636f4b6ec8a0863605b97c7f1039069551cc4..3fc716486c90a7b3a9fe7fa366b93e1fcc2e3155 100644 (file)
@@ -1,3 +1,8 @@
+2010-05-10  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/44050
+       * gcc.dg/torture/pr44050.c: New testcase.
+
 2010-05-10  Wei Guozhi  <carrot@google.com>
 
        PR target/42879
diff --git a/gcc/testsuite/gcc.dg/torture/pr44050.c b/gcc/testsuite/gcc.dg/torture/pr44050.c
new file mode 100644 (file)
index 0000000..931eff6
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-options "-fno-tree-pta" } */
+
+static void __attribute__((noinline))
+foo (int *i, int n)
+{
+  *i = n;
+}
+
+int
+main (void)
+{
+  int i = 0;
+  foo (&i, 1);
+
+  if (i != 1)
+    __builtin_abort ();
+
+  return 0;
+}
+
index 383cc86f24371d21916e31dc5e67e6f170497c3f..8e7d1d6761435cda095d38973663a40b0defbc9e 100644 (file)
@@ -4924,6 +4924,8 @@ tree_function_versioning (tree old_decl, tree new_decl,
     (DECL_STRUCT_FUNCTION (old_decl));
   initialize_cfun (new_decl, old_decl,
                   old_entry_block->count);
+  DECL_STRUCT_FUNCTION (new_decl)->gimple_df->ipa_pta
+    = id.src_cfun->gimple_df->ipa_pta;
   push_cfun (DECL_STRUCT_FUNCTION (new_decl));
 
   /* Copy the function's static chain.  */