From 8f51aa6b267606e25e9b46e9e67ae9c08616ed28 Mon Sep 17 00:00:00 2001 From: Igor Zamyatin Date: Thu, 20 Nov 2014 08:15:21 +0000 Subject: re PR sanitizer/63845 (c-c++-common/asan/bitfield-[12345].c fails on i?86 -with -fpic) 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 | 7 +++++++ gcc/cfgexpand.c | 3 +++ gcc/function.c | 5 ----- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/asan/pr63845.c | 17 +++++++++++++++++ 5 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/asan/pr63845.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index be20db1..69521d3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-11-20 Igor Zamyatin + + 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 * tree.c (free_lang_data_in_type): If BINFO has no important diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 45c13b4..f61140e 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -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 ssa_name_decls; for (i = 0; i < SA.map->num_partitions; i++) { diff --git a/gcc/function.c b/gcc/function.c index ef98091..97e0b79 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 52d2919..772fbd9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-11-20 Igor Zamyatin + + PR sanitizer/63845 + * gcc.dg/asan/pr63845.c: New test. + 2014-11-19 Francois-Xavier Coudert 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 index 0000000..a3fbe06 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/pr63845.c @@ -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; +} + -- cgit v1.1