public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/20331] New: Wrong code generation for the argument of the pure function in PIC
@ 2005-03-05  8:11 kkojima at gcc dot gnu dot org
  2005-03-05  9:10 ` [Bug target/20331] " kkojima at gcc dot gnu dot org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2005-03-05  8:11 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2005-04-01  1:17 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-05  8:11 [Bug target/20331] New: Wrong code generation for the argument of the pure function in PIC kkojima at gcc dot gnu dot org
2005-03-05  9:10 ` [Bug target/20331] " kkojima at gcc dot gnu dot org
2005-03-05 11:43 ` [Bug target/20331] [3.4/4.0/4.1 Regression] " giovannibajo at libero dot it
2005-03-05 11:43 ` [Bug target/20331] [3.4/4.0/41 " giovannibajo at libero dot it
2005-03-05 20:00 ` [Bug target/20331] [3.4/4.0/4.1 " pinskia at gcc dot gnu dot org
2005-03-07  0:20 ` kkojima at gcc dot gnu dot org
2005-03-08 21:58 ` amylaar at gcc dot gnu dot org
2005-03-09 23:58 ` kkojima at gcc dot gnu dot org
2005-03-10  0:12 ` [Bug rtl-optimization/20331] " giovannibajo at libero dot it
2005-03-10  4:24 ` amylaar at gcc dot gnu dot org
2005-03-10 13:57 ` rth at gcc dot gnu dot org
2005-03-10 18:18 ` joern dot rennecke at st dot com
2005-03-11  3:14 ` cvs-commit at gcc dot gnu dot org
2005-03-31 23:21 ` rth at gcc dot gnu dot org
2005-03-31 23:57 ` kkojima at gcc dot gnu dot org
2005-04-01  0:00 ` rth at gcc dot gnu dot org
2005-04-01  0:51 ` kkojima at gcc dot gnu dot org
2005-04-01  1:17 ` rth at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).