public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/5705: code generated for ARM interrupt("IRQ") attribute
@ 2002-02-19  5:56 Phil Blundell
  0 siblings, 0 replies; 2+ messages in thread
From: Phil Blundell @ 2002-02-19  5:56 UTC (permalink / raw)
  To: pb; +Cc: gcc-prs

The following reply was made to PR target/5705; it has been noted by GNATS.

From: Phil Blundell <pb@nexus.co.uk>
To: hans.buchmann@fhso.ch
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/5705: code generated for ARM interrupt("IRQ") attribute
Date: 19 Feb 2002 13:46:35 +0000

 On Fri, 2002-02-15 at 23:35, hans.buchmann@fhso.ch wrote:
 > comparing the lines 
 >  stmfd	sp!, {r1, r2, r3} 
 > and 
 >  ldmfd	sp!, {r0, r1, r2, r3}
 > it seems that stack will be corrupted 
 > >How-To-Repeat:
 > arm-elf-g++ -O3 -fomit-frame-pointer -S error.cc
 
 The bug here seems to be that register renaming is fouling up the
 compiler's idea of which registers are used by the function.  If you
 compile with -O2 or -fno-rename-registers the problem should go away.
 
 I guess regrename feels entitled to pick on R0 because it's listed in
 CALL_USED_REGS.  But for an interrupt function, CALL_USED_REGS doesn't
 reflect the fact that no regs can be clobbered.  I'm not really sure how
 to deal with this.
 
 p.
 


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

* c++/5705: code generated for ARM interrupt("IRQ") attribute
@ 2002-02-15 15:36 hans.buchmann
  0 siblings, 0 replies; 2+ messages in thread
From: hans.buchmann @ 2002-02-15 15:36 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5705
>Category:       c++
>Synopsis:       code generated for ARM interrupt("IRQ") attribute
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 15 15:36:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Hans Buchmann, Institute of Applied Sciences Northwestern Switzerland
>Release:        gcc version 3.0.2
>Organization:
>Environment:
Linux i686 kernel 2.4.3
>Description:
void irq() __attribute__ ((interrupt("IRQ")));

volatile unsigned* reg=(unsigned*)0x1234;

void irq()
{
 unsigned v=*reg;
 *reg=v;
}

compiling this code with the -S option gives the following assembler listing:
@ Generated by gcc 3.0.2 for ARM/elf
	.file	"error.cc"
	.global	reg
	.data
	.align	2
	.type	reg,object
	.size	reg,4
reg:
	.word	4660
	.text
	.align	2
	.global	_Z3irqv
	.type	_Z3irqv,function
_Z3irqv:
	@ Interrupt Service Routine.
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, current_function_anonymous_args = 0
	@ link register save eliminated.
	stmfd	sp!, {r1, r2, r3}
	ldr	r2, .L3
	ldr	r0, [r2, #0]
	ldr	r1, [r0, #0]
	str	r1, [r0, #0]
	ldmfd	sp!, {r0, r1, r2, r3}
	subs	pc, lr, #4
.L4:
	.align	2
.L3:
	.word	reg
.Lfe1:
	.size	_Z3irqv,.Lfe1-_Z3irqv

comparing the lines 
 stmfd	sp!, {r1, r2, r3} 
and 
 ldmfd	sp!, {r0, r1, r2, r3}
it seems that stack will be corrupted 
>How-To-Repeat:
arm-elf-g++ -O3 -fomit-frame-pointer -S error.cc
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2002-02-19 13:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-19  5:56 c++/5705: code generated for ARM interrupt("IRQ") attribute Phil Blundell
  -- strict thread matches above, loose matches on Subject: below --
2002-02-15 15:36 hans.buchmann

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