diff options
author | Andreas Krebbel <Andreas.Krebbel@de.ibm.com> | 2014-01-15 08:36:44 +0000 |
---|---|---|
committer | Andreas Krebbel <krebbel@gcc.gnu.org> | 2014-01-15 08:36:44 +0000 |
commit | cb4b6d170652b99b8aee2430737051cdc42b5517 (patch) | |
tree | a7865eed1a9e633c4ac1eee4731c2dacee7f58b3 /gcc | |
parent | 2738b4c7e3ef411f52dd6664781c4cd8f5b901d4 (diff) | |
download | gcc-cb4b6d170652b99b8aee2430737051cdc42b5517.zip gcc-cb4b6d170652b99b8aee2430737051cdc42b5517.tar.gz gcc-cb4b6d170652b99b8aee2430737051cdc42b5517.tar.bz2 |
s390.c (s390_preferred_reload_class): Don't return ADDR_REGS for invalid symrefs in non-PIC code.
2014-01-15 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* config/s390/s390.c (s390_preferred_reload_class): Don't return
ADDR_REGS for invalid symrefs in non-PIC code.
2014-01-15 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* gcc.c-torture/compile/pr59803.c: New testcase.
From-SVN: r206623
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/s390/s390.c | 15 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr59803.c | 27 |
4 files changed, 47 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5729efd..42c1344 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-01-15 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> + + * config/s390/s390.c (s390_preferred_reload_class): Don't return + ADDR_REGS for invalid symrefs in non-PIC code. + 2014-01-15 Jakub Jelinek <jakub@redhat.com> PR other/58712 diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index eeccaed..91f76f6 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -3148,15 +3148,22 @@ s390_preferred_reload_class (rtx op, reg_class_t rclass) prefer ADDR_REGS. If 'class' is not a superset of ADDR_REGS, e.g. FP_REGS, reject this reload. */ case CONST: - /* A larl operand with odd addend will get fixed via secondary - reload. So don't request it to be pushed into literal - pool. */ + /* Symrefs cannot be pushed into the literal pool with -fPIC + so we *MUST NOT* return NO_REGS for these cases + (s390_cannot_force_const_mem will return true). + + On the other hand we MUST return NO_REGS for symrefs with + invalid addend which might have been pushed to the literal + pool (no -fPIC). Usually we would expect them to be + handled via secondary reload but this does not happen if + they are used as literal pool slot replacement in reload + inheritance (see emit_input_reload_insns). */ if (TARGET_CPU_ZARCH && GET_CODE (XEXP (op, 0)) == PLUS && GET_CODE (XEXP (XEXP(op, 0), 0)) == SYMBOL_REF && GET_CODE (XEXP (XEXP(op, 0), 1)) == CONST_INT) { - if (reg_class_subset_p (ADDR_REGS, rclass)) + if (flag_pic && reg_class_subset_p (ADDR_REGS, rclass)) return ADDR_REGS; else return NO_REGS; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c9eba44..7980dc3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-01-15 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> + + * gcc.c-torture/compile/pr59803.c: New testcase. + 2014-01-15 Jakub Jelinek <jakub@redhat.com> PR c/58943 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr59803.c b/gcc/testsuite/gcc.c-torture/compile/pr59803.c new file mode 100644 index 0000000..d2b5d20 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr59803.c @@ -0,0 +1,27 @@ +/* PR target/59803 */ + +extern void baz (void) __attribute__ ((__noreturn__)); +struct A { int g, h; }; +extern struct A a; +struct B { unsigned char i, j, k, l, m; }; +int c, d, e; +static int f; + +void +foo (void) +{ + f = 1; +} + +void +bar (struct B *x) +{ + x->i = e; + x->k = c; + x->l = d; + x->j = a.h; + x->m = f; + if (x->i != e) baz (); + if (x->k != c) baz (); + if (x->j != a.h) baz (); +} |