[PATCH] [LM32] Fix lm32-elf-gcc build error by remove unnecessary constant legitimate check.

Jia Liu proljc@gmail.com
Tue Jul 10 14:16:00 GMT 2012


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.

When I remove the unnecessary constant legitimate check, lm32-elf-gcc
is built OK.
And I made a patch for this. Please review.

---
 gcc/config/lm32/lm32.c |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/gcc/config/lm32/lm32.c b/gcc/config/lm32/lm32.c
index 376df05..47024ff 100644
--- a/gcc/config/lm32/lm32.c
+++ b/gcc/config/lm32/lm32.c
@@ -1236,9 +1236,5 @@ lm32_move_ok (enum machine_mode mode, rtx operands[2]) {
 static bool
 lm32_legitimate_constant_p (enum machine_mode mode, rtx x)
 {
-  /* 32-bit addresses require multiple instructions.  */
-  if (!flag_pic && reloc_operand (x, mode))
-    return false;
-
   return true;
 }
--

ChangeLog

2012-07-10  Jia Liu  <proljc@gmail.com>

gcc/
        * config/lm32/lm32.c (lm32_legitimate_constant_p): Remove
unnecessary constant legitimate check.

Regards,
Jia
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-remove-the-unnecessary-constant-check.patch
Type: application/octet-stream
Size: 778 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120710/3c20f5c1/attachment.obj>


More information about the Gcc-patches mailing list