c++/5705: code generated for ARM interrupt("IRQ") attribute
hans.buchmann@fhso.ch
hans.buchmann@fhso.ch
Sat Feb 16 04:55:00 GMT 2002
>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:
More information about the Gcc-bugs
mailing list