This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/20331] New: Wrong code generation for the argument of the pure function in PIC
- From: "kkojima at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Mar 2005 08:11:39 -0000
- Subject: [Bug target/20331] New: Wrong code generation for the argument of the pure function in PIC
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The C code below
extern __attribute__((pure)) int pf (int *);
extern int bar;
int foo (void) { return pf (&bar);}
is wrongly compiled with -fPIC on sh64-elf. The output doesn't
any references to the symbol bar:
.section .text..SHmedia32,"ax"
.align 2
.global _foo
.type _foo, @function
_foo:
addi.l r15, -24, r15
st.l r15, 12, r18
st.l r15, 8, r14
st.l r15, 4, r12
movi (((datalabel _GLOBAL_OFFSET_TABLE_-(.LPCS0-.)) >> 16) & 65535), r12
shori ((datalabel _GLOBAL_OFFSET_TABLE_-(.LPCS0-.)) & 65535), r12
.LPCS0: ptrel/u r12, tr0
gettr tr0, r12
add.l r15, r63, r14
ld.l r2, 0, r2
movi (((_pf@GOTPLT) >> 16) & 65535), r1
shori ((_pf@GOTPLT) & 65535), r1
ldx.l r1, r12, r1
ptabs r1, tr0
blink tr0, r18
add.l r14, r63, r15
ld.l r15, 4, r12
ld.l r15, 8, r14
ld.l r15, 12, r18
addi.l r15, 24, r15
ptabs r18, tr0
blink tr0, r63
.size _foo, .-_foo
I confirmed that 3.4/4.0 behaves same and 3.3.6 compiler produces
the sane code. So this is a regression from 3.3 to 3.4/4.0/4.1.
--
Summary: Wrong code generation for the argument of the pure
function in PIC
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P2
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kkojima at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: sh64-unknown-elf
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20331