This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] [LM32] Fix lm32-elf-gcc build error by remove unnecessary constant legitimate check.
Hi Hans,
On Thu, Jul 12, 2012 at 10:04 AM, Hans-Peter Nilsson <hp@bitrange.com> wrote:
> On Tue, 10 Jul 2012, Jia Liu wrote:
>> Hi all,
>>
>> When I build lm32-elf-gcc, it failed at libgcc configure due to
>> lm32-elf-cc1 segment fault when compile conftest.c:
>>
>> void bar ();
>> void clean (int *);
>> void foo ()
>> {
>> int i __attribute__ ((cleanup (clean)));
>> bar();
>> }
>>
>> Then I find lm32_legitimate_constant_p return false too much times, it
>> shouldn't like this, I think.
>>
>> And I find the movsi pattern has handle the pic and reloc_operand, but
>> lm32_legitimate_constant_p
>> handle them again, so, I think maybe it is unnecessary.
>
> The movsi pattern really is expected to handle it; the
> TARGET_LEGITIMATE_CONSTANT_P (i.e. lm32_legitimate_constant_p)
> is for immediate operands to *other* insns. The movsi pattern
> is expected to handle the rest. The correct solution is
> elsewhere.
>
Thank you for comment.
And, I find that lm32_legitimate_constant_p never be used before 4.6.0
but everything goes 'OK',
but if I fix it like this, it will FAIL at ~newlib~ build. May you
give me more comment? I wanna fix it.
To be honest, I summit a patch just make libgcc make OK to get comment
from here.
>> When I remove the unnecessary constant legitimate check, lm32-elf-gcc
>> is built OK.
>
> But most likely will fail to generate correct code for some
> source codes for which it worked before.
>
> A patch like this needs a full test-suite run anyway.
>
I'll make one, thanks.
> (Not an approver-review.)
>
> brgds, H-P
Regards,
Jia