This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] mips/mips.c: Fix PR target/26765
- From: Kazu Hirata <kazu at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: richard at codesourcery dot com
- Cc: echristo at apple dot com
- Date: Thu, 4 May 2006 13:19:36 -0700
- Subject: [patch] mips/mips.c: Fix PR target/26765
Hi,
Attached is a patch to fix PR target/26765.
Without this patch, the testcase below triggers an unrecognizable insn:
(set (reg/f:SI 193)
(mem/c/i:SI (lo_sum:SI (reg:SI 195)
(const:SI (unspec:SI [(symbol_ref:SI ("a") [flags 0x22]
<var_decl 0xb7c4a840 a>)]
114))) [2 a+0 S4 A32])) -1 (nil)
(nil))
However, the address above is actuallly a valid address in MIPS
according to Richard Sandiford.
The patch fixes the problem by relaxing mips_symbolic_address_p.
Tested on mips-none-elf. Committed to mainline, 4.1, and
sourcerygxx-4_1 as preapproved by Richard Sandiford.
Kazu Hirata
2006-05-04 Richard Sandiford <richard@codesourcery.com>
PR target/26765
* config/mips/mips.c (mips_symbolic_address_p): Return true
for SYMBOL_TLSGD, SYMBOL_TLSLDM, SYMBOL_DTPREL, SYMBOL_TPREL,
SYMBOL_GOTTPREL, and SYMBOL_TLS.
2006-05-04 Kazu Hirata <kazu@codesourcery.com>
PR target/26765
* gcc.target/mips/pr26765.c: New.
Index: config/mips/mips.c
===================================================================
--- config/mips/mips.c (revision 113428)
+++ config/mips/mips.c (working copy)
@@ -1463,18 +1463,16 @@ mips_symbolic_address_p (enum mips_symbo
/* The address will have to be loaded from the GOT first. */
return false;
- case SYMBOL_TLSGD:
- case SYMBOL_TLSLDM:
- case SYMBOL_DTPREL:
- case SYMBOL_TPREL:
- case SYMBOL_GOTTPREL:
- case SYMBOL_TLS:
- return false;
-
case SYMBOL_GOTOFF_PAGE:
case SYMBOL_GOTOFF_GLOBAL:
case SYMBOL_GOTOFF_CALL:
case SYMBOL_GOTOFF_LOADGP:
+ case SYMBOL_TLS:
+ case SYMBOL_TLSGD:
+ case SYMBOL_TLSLDM:
+ case SYMBOL_DTPREL:
+ case SYMBOL_GOTTPREL:
+ case SYMBOL_TPREL:
case SYMBOL_64_HIGH:
case SYMBOL_64_MID:
case SYMBOL_64_LOW:
--- /dev/null 2006-03-11 08:41:44.866675760 -0800
+++ testsuite/gcc.target/mips/pr26765.c 2006-05-04 12:53:56.000000000 -0700
@@ -0,0 +1,13 @@
+/* PR target/pr26765
+ This testcase used to trigger an unrecognizable insn. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+__thread int *a = 0;
+
+void foo (void)
+{
+ extern int *b;
+ b = (int *) ((*a));
+}