public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* target/10412: Renesas SH - Incorrect code generation
@ 2003-04-15 11:56 shrinivasa
  0 siblings, 0 replies; only message in thread
From: shrinivasa @ 2003-04-15 11:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         10412
>Category:       target
>Synopsis:       Renesas SH - Incorrect code generation
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 15 11:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     shrinivasa@kpitcummins.com
>Release:        GCC Snapshor 14/04/2003 and GCC CVS
>Organization:
>Environment:
[shrinivasa@Linuxsrv5 bug]$ ~/sh-elf-cvs/bin/sh-elf-gcc -v
Reading specs from /home/shrinivasa/sh-elf-cvs/lib/gcc-lib/sh-elf/3.4/specs
Configured with: /home/shrinivasa/src/gcc/configure --enable-languages=c,c++ --t
arget=sh-elf --with-newlib --with-headers=/home/shrinivasa/src/newlib-1.11.0/new
lib/libc/include --prefix=/home/shrinivasa/sh-elf-cvs
Thread model: single
gcc version 3.4 20030415 (experimental)

and 


Reading specs from /home/shrinivasa/sh-elf-15042003/lib/gcc-lib/sh-elf/3.3/specs

Configured with: /home/shrinivasa/src/gcc-20030414/configure --enable-languages=
c,c++ --target=sh-elf --with-newlib --prefix=/home/shrinivasa/sh-elf-15042003 :
(reconfigured) /home/shrinivasa/src/gcc-20030414/configure --enable-languages=c,
c++ --target=sh-elf --with-newlib --prefix=/home/shrinivasa/sh-elf-15042003 : (r
econfigured) /home/shrinivasa/src/gcc-20030414/configure --enable-languages=c,c+
+ --target=sh-elf --with-newlib --with-headers=/home/shrinivasa/src/newlib-1.11.
0/newlib/libc/include --prefix=/home/shrinivasa/sh-elf-15042003
Thread model: single
gcc version 3.3 20030414 (prerelease)
>Description:
When following code is compiled  with
sh-elf-gcc  -S  -mhitachi -m2 -O2 -bug1-cvs.s bug1.c
generates an incorrect code.

int func0 (int x);

int func1 (unsigned long addr)
{
  int err;

  err = func0 (addr);
  if (err) return (err);

  err = func0 (addr * 7);
  return (err);
}

The generated code is 

	.file	"bug1.c"
	.text
	.text
	.align 1
	.align 4
	.global	_func1
	.type	_func1, @function
_func1:
	mov.l	r8,@-r15
	mov.l	r14,@-r15
	mov	r4,r8
	sts.l	macl,@-r15
	mov.l	.L6,r1
	sts.l	pr,@-r15
	jsr	@r1
	mov	r15,r14
	tst	r0,r0
	bt	.L5
	mov	r14,r15
	lds.l	@r15+,pr
	lds.l	@r15+,macl
	mov.l	@r15+,r14
	rts	
	mov.l	@r15+,r8
	.align 4
.L5:
	mov	#7,r1 ; <<<<< HERE  address of func0 is lost 
	mul.l	r1,r8
	sts	macl,r4
	mov	r14,r15
	lds.l	@r15+,pr
	lds.l	@r15+,macl
	mov.l	@r15+,r14
	jmp	@r4	; <<<<< R4 contains multiplication, incorrect jump
	mov.l	@r15+,r8
.L7:
	.align 2
.L6:
	.long	_func0
	.size	_func1, .-_func1
	.ident	"GCC: (GNU) 3.4 20030415 (experimental)"

The same problem is observed for current snapshot of GCC also. ( Dated 14th April 2003)
>How-To-Repeat:
Compile the attached bug1.c with following command.
sh-elf-gcc  -S  -mhitachi -m2 -O2 -.s bug1.c

Problem occurs for current CVS branch as well as latest GCC-3.3 snapshot.
>Fix:
None.
If -mhitachi switch is not used then the problem disappears.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/x-zip-compressed; name="bug.zip"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="bug.zip"

UEsDBBQAAAAIACeJjy75vYklEQEAADYCAAAKAAAAYnVnMS1jdnMuc6VRPW/CMBCdz78iShdQjRWD
A1GmSAwsqFvnKgkmMnI+dHYq2l9fO2kCtCOT7927u/fOB+ystISw6CvOypAAs/Jqb0+uVdUEfI6E
iyrdFrmGj3PflJ6xX538RTTI/GtV25AxkxKo20+mAROarZDHM+biLgEoKCYEjDWOq/N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only message in thread

only message in thread, other threads:[~2003-04-15 11:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-15 11:56 target/10412: Renesas SH - Incorrect code generation shrinivasa

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).