diff options
author | Jan Hubicka <jh@suse.cz> | 2000-08-02 14:28:14 +0000 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2000-08-02 14:28:14 +0000 |
commit | 4e9efe546e1443219d13d8fab76adaed392cd6c7 (patch) | |
tree | 718108b3040b599162643b2f30c9b1f8400a4fae /gcc/config/i386 | |
parent | ca4ae08d95126ce975cf5cb82dc77fbc2b839bfc (diff) | |
download | gcc-4e9efe546e1443219d13d8fab76adaed392cd6c7.zip gcc-4e9efe546e1443219d13d8fab76adaed392cd6c7.tar.gz gcc-4e9efe546e1443219d13d8fab76adaed392cd6c7.tar.bz2 |
i386.c (legitimate_address_p): Accept other bases than pic_offset_table_rtx for GOTOFF constructs.
* i386.c (legitimate_address_p): Accept other bases than
pic_offset_table_rtx for GOTOFF constructs.
From-SVN: r35424
Diffstat (limited to 'gcc/config/i386')
-rw-r--r-- | gcc/config/i386/i386.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index c5289ab..68a78e9 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -2506,14 +2506,27 @@ legitimate_address_p (mode, addr, strict) goto error; } - /* Verify that a symbolic pic displacement includes - the pic_offset_table_rtx register. */ - if (base != pic_offset_table_rtx - && (index != pic_offset_table_rtx || scale != 1)) - { - reason = "pic displacement against invalid base"; - goto error; - } + /* This code used to verify that a symbolic pic displacement + includes the pic_offset_table_rtx register. + + While this is good idea, unfortunately these constructs may + be created by "adds using lea" optimization for incorrect + code like: + + int a; + int foo(int i) + { + return *(&a+i); + } + + This code nonsential, but results in addressing + GOT table with pic_offset_table_rtx base. We can't + just refuse it easilly, since it gets matched by + "addsi3" pattern, that later gets split to lea in the + case output register differs from input. While this + can be handled by separate addsi pattern for this case + that never results in lea, this seems to be easier and + correct fix for crash to disable this test. */ } else if (HALF_PIC_P ()) { |