From 682303da799ead98af850842873bf9a66dd3ddb0 Mon Sep 17 00:00:00 2001 From: Vladimir Makarov Date: Fri, 19 Apr 2013 19:55:57 +0000 Subject: [PATCH] re PR rtl-optimization/56847 ('-fpie' triggers - internal compiler error: in gen_add2_insn, at optabs.c:4705) 2013-04-19 Vladimir Makarov PR rtl-optimization/56847 * lra-constraints.c (process_alt_operands): Discourage alternative with non-matche doffsettable memory constraint fro memory with known offset. From-SVN: r198101 --- gcc/ChangeLog | 7 +++++++ gcc/lra-constraints.c | 11 +++++++++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr56847.c | 12 ++++++++++++ 4 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr56847.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e2aca32..c27e4da 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-04-19 Vladimir Makarov + + PR rtl-optimization/56847 + * lra-constraints.c (process_alt_operands): Discourage alternative + with non-matche doffsettable memory constraint fro memory with + known offset. + 2013-04-19 Richard Biener PR tree-optimization/56982 diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index e3b4add..9e4924c 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -1978,8 +1978,15 @@ process_alt_operands (int only_alternative) (op, this_alternative) == NO_REGS)))) reject += LRA_MAX_REJECT; - if (! ((const_to_mem && constmemok) - || (MEM_P (op) && offmemok))) + if (MEM_P (op) && offmemok) + { + /* If we know offset and this non-offsetable memory, + something wrong with this memory and it is better + to try other memory possibilities. */ + if (MEM_OFFSET_KNOWN_P (op)) + reject += LRA_MAX_REJECT; + } + else if (! (const_to_mem && constmemok)) { /* We prefer to reload pseudos over reloading other things, since such reloads may be able to be diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a31889a..7227e5e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-04-19 Vladimir Makarov + + PR rtl-optimization/56847 + * gcc.dg/pr56847.c: New test. + 2013-04-19 Richard Biener PR tree-optimization/56982 diff --git a/gcc/testsuite/gcc.dg/pr56847.c b/gcc/testsuite/gcc.dg/pr56847.c new file mode 100644 index 0000000..b94aae1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr56847.c @@ -0,0 +1,12 @@ +/* PR rtl-optimization/56847 */ +/* { dg-do compile { target pie } } */ +/* { dg-options "-O2 -fpie" } */ + +struct S { long int a, b; } e; +__thread struct S s; + +void +foo (void) +{ + s = e; +} -- 2.7.4