diff options
Diffstat (limited to 'gcc/reload1.c')
-rw-r--r-- | gcc/reload1.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c index 2be0983a2ac..0b53ac90501 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -778,7 +778,11 @@ reload (first, global) #ifdef LEGITIMATE_PIC_OPERAND_P && (! function_invariant_p (XEXP (note, 0)) || ! flag_pic - || LEGITIMATE_PIC_OPERAND_P (XEXP (note, 0))) + /* A function invariant is often CONSTANT_P but may + include a register. We promise to only pass + CONSTANT_P objects to LEGITIMATE_PIC_OPERAND_P. */ + || (CONSTANT_P (XEXP (note, 0)) + && LEGITIMATE_PIC_OPERAND_P (XEXP (note, 0)))) #endif ) { |