re PR sanitizer/63845 (c-c++-common/asan/bitfield-[12345].c fails on i?86 -with ...
authorIgor Zamyatin <igor.zamyatin@intel.com>
Thu, 20 Nov 2014 08:15:21 +0000 (08:15 +0000)
committerIlya Enkovich <ienkovich@gcc.gnu.org>
Thu, 20 Nov 2014 08:15:21 +0000 (08:15 +0000)
gcc/

PR sanitizer/63845
* function.c (assign_parms): Move init of pic_offset_table_rtx
from here to...
* cfgexpand.c (expand_used_vars): ...here.

gcc/testsuite/

PR sanitizer/63845
* gcc.dg/asan/pr63845.c: New test.

From-SVN: r217825

gcc/ChangeLog
gcc/cfgexpand.c
gcc/function.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/asan/pr63845.c [new file with mode: 0644]

index be20db1d2002c4c9ff1218917145e790ea500895..69521d3dd545e26f5520457dc1ade29b1608b14a 100644 (file)
@@ -1,3 +1,10 @@
+2014-11-20  Igor Zamyatin  <igor.zamyatin@intel.com>
+
+       PR sanitizer/63845
+       * function.c (assign_parms): Move init of pic_offset_table_rtx
+       from here to...
+       * cfgexpand.c (expand_used_vars): ...here.
+
 2014-11-19  Jan Hubicka  <hubicka@ucw.cz>
 
        * tree.c (free_lang_data_in_type): If BINFO has no important
index 45c13b48ae3caa51c1e3af73dd7d551da6c2b5fb..f61140e2f72120c04e67de9bb0039a32f7733904 100644 (file)
@@ -1722,6 +1722,9 @@ expand_used_vars (void)
 
   init_vars_expansion ();
 
+  if (targetm.use_pseudo_pic_reg ())
+    pic_offset_table_rtx = gen_reg_rtx (Pmode);
+
   hash_map<tree, tree> ssa_name_decls;
   for (i = 0; i < SA.map->num_partitions; i++)
     {
index ef9809159096392d04c1896cd9a6972ad9ac9145..97e0b79ac4a21bf8a80bce1e1b62e4358f9e7942 100644 (file)
@@ -3679,11 +3679,6 @@ assign_parms (tree fndecl)
 
   fnargs.release ();
 
-  /* Initialize pic_offset_table_rtx with a pseudo register
-     if required.  */
-  if (targetm.use_pseudo_pic_reg ())
-    pic_offset_table_rtx = gen_reg_rtx (Pmode);
-
   /* Output all parameter conversion instructions (possibly including calls)
      now that all parameters have been copied out of hard registers.  */
   emit_insn (all.first_conversion_insn);
index 52d2919937cdcead6dc729b29d1599e8e11a62bd..772fbd96d09f75148ad9965dfee67ef91e7a2c43 100644 (file)
@@ -1,3 +1,8 @@
+2014-11-20  Igor Zamyatin  <igor.zamyatin@intel.com>
+
+       PR sanitizer/63845
+       * gcc.dg/asan/pr63845.c: New test.
+
 2014-11-19  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        PR sanitizer/63939
diff --git a/gcc/testsuite/gcc.dg/asan/pr63845.c b/gcc/testsuite/gcc.dg/asan/pr63845.c
new file mode 100644 (file)
index 0000000..a3fbe06
--- /dev/null
@@ -0,0 +1,17 @@
+/* PR sanitizer/63845 */
+/* { dg-do compile } */
+/* { dg-options "-fPIC" { target fpic }  } */
+
+int __attribute__ ((noinline, noclone))
+foo (void *p)
+{
+  return *(int*)p;
+}
+
+int main ()
+{
+  char a = 0;
+  foo (&a);
+  return 0;
+}
+