From: "Zamyatin, Igor" <igor.zamyatin@intel.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: "H.J. Lu" <hjl.tools@gmail.com>, Jeff Law <law@redhat.com>,
"GCC Patches (gcc-patches@gcc.gnu.org)" <gcc-patches@gcc.gnu.org>
Subject: RE: [PATCH, i686] Fix for asan test failures with -m32 happened after EBX enabling in PIC mode
Date: Fri, 14 Nov 2014 17:31:00 -0000 [thread overview]
Message-ID: <0EFAB2BDD0F67E4FB6CCC8B9F87D756969C52752@IRSMSX101.ger.corp.intel.com> (raw)
In-Reply-To: <20141114171018.GW5026@tucnak.redhat.com>
> On Fri, Nov 14, 2014 at 05:05:57PM +0000, Zamyatin, Igor wrote:
>
> It is not that easy, -fsanitize=address is not supported everywhere.
> Better if you stick it into testsuite/gcc.dg/asan/ No point adding effective-
> target ia32/fpic, there is nothing i?86 specific, not even ix86/x86_64 specific,
> nor pic specific in the test, just use
> /* { dg-additional-options "-fPIC" { target fpic } } */
Thanks, updated.
gcc/Changelog
2014-11-14 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.
gcc/testsuite/Changelog
2014-11-14 Igor Zamyatin <igor.zamyatin@intel.com>
PR sanitizer/63845
* gcc.dg/asan/pr63845.c: New test.
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 15d7638..bcd3b35 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<tree, tree> 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/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;
+}
Igor
>
> Jakub
next prev parent reply other threads:[~2014-11-14 17:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-31 16:42 Zamyatin, Igor
2014-10-31 19:08 ` Jeff Law
2014-11-05 15:20 ` Zamyatin, Igor
2014-11-13 13:20 ` H.J. Lu
2014-11-14 17:01 ` Zamyatin, Igor
2014-11-14 17:08 ` H.J. Lu
2014-11-14 17:09 ` Zamyatin, Igor
2014-11-14 17:11 ` Jakub Jelinek
2014-11-14 17:31 ` Zamyatin, Igor [this message]
2014-11-18 0:15 ` Jeff Law
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0EFAB2BDD0F67E4FB6CCC8B9F87D756969C52752@IRSMSX101.ger.corp.intel.com \
--to=igor.zamyatin@intel.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hjl.tools@gmail.com \
--cc=jakub@redhat.com \
--cc=law@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).