public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/16634] arm-elf-gcc problems when generating code for __attribute__ ((interrupt ("IRQ")))
[not found] <bug-16634-8979@http.gcc.gnu.org/bugzilla/>
@ 2006-08-08 23:05 ` pbrook at gcc dot gnu dot org
2006-08-08 23:47 ` pbrook at gcc dot gnu dot org
` (10 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: pbrook at gcc dot gnu dot org @ 2006-08-08 23:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pbrook at gcc dot gnu dot org 2006-08-08 23:05 -------
*** Bug 25428 has been marked as a duplicate of this bug. ***
--
pbrook at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |th dot r dot klein at web
| |dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16634
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/16634] arm-elf-gcc problems when generating code for __attribute__ ((interrupt ("IRQ")))
[not found] <bug-16634-8979@http.gcc.gnu.org/bugzilla/>
2006-08-08 23:05 ` [Bug target/16634] arm-elf-gcc problems when generating code for __attribute__ ((interrupt ("IRQ"))) pbrook at gcc dot gnu dot org
@ 2006-08-08 23:47 ` pbrook at gcc dot gnu dot org
2006-09-11 10:41 ` rearnsha at gcc dot gnu dot org
` (9 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: pbrook at gcc dot gnu dot org @ 2006-08-08 23:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pbrook at gcc dot gnu dot org 2006-08-08 23:47 -------
Patch here:
http://gcc.gnu.org/ml/gcc-patches/2006-08/msg00230.html
--
pbrook at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2006-08-08 23:47:42
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16634
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/16634] arm-elf-gcc problems when generating code for __attribute__ ((interrupt ("IRQ")))
[not found] <bug-16634-8979@http.gcc.gnu.org/bugzilla/>
2006-08-08 23:05 ` [Bug target/16634] arm-elf-gcc problems when generating code for __attribute__ ((interrupt ("IRQ"))) pbrook at gcc dot gnu dot org
2006-08-08 23:47 ` pbrook at gcc dot gnu dot org
@ 2006-09-11 10:41 ` rearnsha at gcc dot gnu dot org
2006-09-11 11:31 ` tbm at cyrius dot com
` (8 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2006-09-11 10:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from rearnsha at gcc dot gnu dot org 2006-09-11 10:41 -------
*** Bug 29004 has been marked as a duplicate of this bug. ***
--
rearnsha at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hans dot buchmann at fhso
| |dot ch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16634
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/16634] arm-elf-gcc problems when generating code for __attribute__ ((interrupt ("IRQ")))
[not found] <bug-16634-8979@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2006-09-11 10:41 ` rearnsha at gcc dot gnu dot org
@ 2006-09-11 11:31 ` tbm at cyrius dot com
2006-11-14 16:28 ` tla at thrane dot com
` (7 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: tbm at cyrius dot com @ 2006-09-11 11:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from tbm at cyrius dot com 2006-09-11 11:31 -------
(In reply to comment #2)
> Patch here:
> http://gcc.gnu.org/ml/gcc-patches/2006-08/msg00230.html
What's the status of this patch?
--
tbm at cyrius dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rearnsha at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16634
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/16634] arm-elf-gcc problems when generating code for __attribute__ ((interrupt ("IRQ")))
[not found] <bug-16634-8979@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2006-09-11 11:31 ` tbm at cyrius dot com
@ 2006-11-14 16:28 ` tla at thrane dot com
2007-01-04 0:10 ` pbrook at gcc dot gnu dot org
` (6 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: tla at thrane dot com @ 2006-11-14 16:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from tla at thrane dot com 2006-11-14 16:28 -------
(In reply to comment #4)
> What's the status of this patch?
The bug is also present in arm-elf-gcc version 4.1.0
However, adding the -fno-omit-frame-pointer parameter, make
the compiler emit the correct code in the mentioned code example.
--
tla at thrane dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tla at thrane dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16634
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/16634] arm-elf-gcc problems when generating code for __attribute__ ((interrupt ("IRQ")))
[not found] <bug-16634-8979@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2006-11-14 16:28 ` tla at thrane dot com
@ 2007-01-04 0:10 ` pbrook at gcc dot gnu dot org
2007-05-03 2:14 ` david+gcc at porkrind dot org
` (5 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: pbrook at gcc dot gnu dot org @ 2007-01-04 0:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pbrook at gcc dot gnu dot org 2007-01-04 00:09 -------
Subject: Bug 16634
Author: pbrook
Date: Thu Jan 4 00:09:48 2007
New Revision: 120413
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120413
Log:
2007-01-03 Paul Brook <paul@codesourcery.com>
PR target/16634
gcc/
* config/arm/arm.c (output_return_instruction): Pop PC in interrupt
functions.
(use_return_insn): Return 0 for Thumb interrupt functions.
(print_multi_reg): Add rfe argument for IRQ returns.
(arm_output_epilogue): Pop interrupt return address directly into PC.
(arm_expand_prologue): Only adjust IRQ return address in Arm mode.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/arm/arm.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16634
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/16634] arm-elf-gcc problems when generating code for __attribute__ ((interrupt ("IRQ")))
[not found] <bug-16634-8979@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2007-01-04 0:10 ` pbrook at gcc dot gnu dot org
@ 2007-05-03 2:14 ` david+gcc at porkrind dot org
2007-08-06 9:08 ` sgh at sgh dot dk
` (4 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: david+gcc at porkrind dot org @ 2007-05-03 2:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from david+gcc at porkrind dot org 2007-05-03 03:14 -------
This still fails in gcc 4.1.2 under certain conditions. I can provide a test
case if necessary.
--
david+gcc at porkrind dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |david+gcc at porkrind dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16634
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/16634] arm-elf-gcc problems when generating code for __attribute__ ((interrupt ("IRQ")))
[not found] <bug-16634-8979@http.gcc.gnu.org/bugzilla/>
` (6 preceding siblings ...)
2007-05-03 2:14 ` david+gcc at porkrind dot org
@ 2007-08-06 9:08 ` sgh at sgh dot dk
2007-11-08 21:42 ` ralf dot guetlein at web dot de
` (3 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: sgh at sgh dot dk @ 2007-08-06 9:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from sgh at sgh dot dk 2007-08-06 09:08 -------
also fails on 4.2.1
--
sgh at sgh dot dk changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sgh at sgh dot dk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16634
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/16634] arm-elf-gcc problems when generating code for __attribute__ ((interrupt ("IRQ")))
[not found] <bug-16634-8979@http.gcc.gnu.org/bugzilla/>
` (7 preceding siblings ...)
2007-08-06 9:08 ` sgh at sgh dot dk
@ 2007-11-08 21:42 ` ralf dot guetlein at web dot de
2008-02-07 13:55 ` mmz at gmx dot net
` (2 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: ralf dot guetlein at web dot de @ 2007-11-08 21:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from ralf dot guetlein at web dot de 2007-11-08 21:42 -------
(In reply to comment #8)
> also fails on 4.2.1
is this bug still present in 4.2.2?
Acc. to my obervations the error only shows up when not all auto variables can
be mapped to registers, and additional variables are located on stack. As a
work-around, if a more complex interrupt handler is needed, place the code in a
subfunction and call this function from the interrupt handler. In this case no
stack is reserved in the interrupt handler, and the generated code is OK. Care
must be taken, of course, that the optimizer does not inline the code for
IntFunc().
Example:
void IntFunc(void);
__attribute__((interrupt("IRQ")) void IntHandler(void)
{
IntFunc();
}
__attribute__(noinline)) void IntFunc(void)
{
// interrupt code here!
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16634
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/16634] arm-elf-gcc problems when generating code for __attribute__ ((interrupt ("IRQ")))
[not found] <bug-16634-8979@http.gcc.gnu.org/bugzilla/>
` (8 preceding siblings ...)
2007-11-08 21:42 ` ralf dot guetlein at web dot de
@ 2008-02-07 13:55 ` mmz at gmx dot net
2009-02-12 21:58 ` sgh at sgh dot dk
2010-01-09 23:27 ` ramana at gcc dot gnu dot org
11 siblings, 0 replies; 14+ messages in thread
From: mmz at gmx dot net @ 2008-02-07 13:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from mmz at gmx dot net 2008-02-07 13:54 -------
(In reply to comment #9)
> is this bug still present in 4.2.2?
I can confirm this bug still exists in 4.2.2 and 4.2.3.
> Acc. to my obervations the error only shows up when not all auto variables can
> be mapped to registers, and additional variables are located on stack. As a
> work-around, if a more complex interrupt handler is needed, place the code in a
> subfunction and call this function from the interrupt handler. In this case no
> stack is reserved in the interrupt handler, and the generated code is OK. Care
> must be taken, of course, that the optimizer does not inline the code for
> IntFunc().
Your subfunction workaround actually did the trick. The generated return
instruction is "ldm sp!, {r0, r1, r2, r3, ip, pc}^". However, if a more complex
interrupt handler is implemented the wrong return instruction generated. The
results seem a bit unpredictable so I currently use plain assembler for my
interrupts.
Example:
extern __attribute__ ((interrupt ("IRQ"))) void
base_int_ctrl_top_irq_handler(void)
{
int_ctrl_status_t status;
status.val = READ_REG_U32(ADDR_STATUS_NIRQ);
if (status.bf.x) {
puts("Spurious x IRQ!");
} else if (status.bf.y) {
puts("Spurious y IRQ!");
} else if (status.bf.timer) {
base_timer_interrupt();
} else if (status.bf.z) {
puts("Spurious z IRQ!");
} else {
puts("Spurious unknown IRQ!");
}
}
Generated assembly for return:
pop {r0, r1, r2, r3, ip, lr}
subs pc, lr, #4 ; 0x4
(and lr was already decremented by 4 when the handler was entered)
So your observations are correct.
Bug #27859 seems to be a duplicate of this bug and contains a patch. However,
this patch is probably not optimal since it just replaces the final "subs" by a
"movs" while the best solution seems to be the "ldmfd ..." instruction above.
--
mmz at gmx dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mmz at gmx dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16634
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/16634] arm-elf-gcc problems when generating code for __attribute__ ((interrupt ("IRQ")))
[not found] <bug-16634-8979@http.gcc.gnu.org/bugzilla/>
` (9 preceding siblings ...)
2008-02-07 13:55 ` mmz at gmx dot net
@ 2009-02-12 21:58 ` sgh at sgh dot dk
2010-01-09 23:27 ` ramana at gcc dot gnu dot org
11 siblings, 0 replies; 14+ messages in thread
From: sgh at sgh dot dk @ 2009-02-12 21:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from sgh at sgh dot dk 2009-02-12 21:58 -------
Since this is not marked to be fixes I assume is hasn't been fixed in 4.3.3.
Wat is wrong with Pauls patch since it hasn't been included ?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16634
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/16634] arm-elf-gcc problems when generating code for __attribute__ ((interrupt ("IRQ")))
[not found] <bug-16634-8979@http.gcc.gnu.org/bugzilla/>
` (10 preceding siblings ...)
2009-02-12 21:58 ` sgh at sgh dot dk
@ 2010-01-09 23:27 ` ramana at gcc dot gnu dot org
11 siblings, 0 replies; 14+ messages in thread
From: ramana at gcc dot gnu dot org @ 2010-01-09 23:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from ramana at gcc dot gnu dot org 2010-01-09 23:27 -------
The code generated on trunk, 4.4 and 4.3 with arm-eabi-gcc at O2 for the test
in Comment #0 is
int_handler:
@ Interrupt Service Routine.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
sub lr, lr, #4
stmfd sp!, {r0, r1, r2, r3, ip, lr}
bl foo
ldmfd sp!, {r0, r1, r2, r3, ip, pc}^
which appears to be the expected code generated.
This appears to be fixed. If there is a problem please open a separate bug
report. I tried the testcase in Comment #10 but that doesn't even compile .
Attempting to reverse create a testcase using similar structs didn't show the
problem.
--
ramana at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Priority|P2 |P4
Resolution| |FIXED
Target Milestone|--- |4.3.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16634
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/16634] New: arm-elf-gcc 3.4.0 problems when generating code for __attribute__ ((interrupt ("IRQ")))
@ 2004-07-19 19:27 bob at cnxtech dot com
2004-10-07 16:14 ` [Bug target/16634] arm-elf-gcc " pinskia at gcc dot gnu dot org
2005-07-02 1:31 ` pinskia at gcc dot gnu dot org
0 siblings, 2 replies; 14+ messages in thread
From: bob at cnxtech dot com @ 2004-07-19 19:27 UTC (permalink / raw)
To: gcc-bugs
The gcc 3.4.0 still have problems on generating the entry/exit code for
interrupts, if we supress the "apcs-frame" option. When the code is compiled
with "-mno-apcs-frame" the entry code subtracts 4 from the "lr" before pushing
it into stack, and do it again on the exit code.
__attribute__ ((interrupt ("IRQ"))) void int_handler(void)
{
foo();
}
arm-elf-gcc -mcpu=arm7tdmi -mno-apcs-frame -mthumb-interwork -Wall -O2 -c test.c
00000000 <int_handler>:
0: e24ee004 sub lr, lr, #4 ; 0x4
4: e92d500f stmdb sp!, {r0, r1, r2, r3, ip, lr}
8: ebfffffe bl 0 <int_handler>
c: e8bd500f ldmia sp!, {r0, r1, r2, r3, ip, lr}
10: e25ef004 subs pc, lr, #4 ; 0x4
arm-elf-gcc -mcpu=arm7tdmi -mapcs-frame -mthumb-interwork -Wall -O2 -c test.c
00000000 <int_handler>:
0: e52dc004 str ip, [sp, -#4]!
4: e1a0c00d mov ip, sp
8: e92dd80f stmdb sp!, {r0, r1, r2, r3, fp, ip, lr, pc}
c: e24cb004 sub fp, ip, #4 ; 0x4
10: ebfffffe bl 0 <int_handler>
14: e89d680f ldmia sp, {r0, r1, r2, r3, fp, sp, lr}
18: e8bd1000 ldmia sp!, {ip}
1c: e25ef004 subs pc, lr, #4 ; 0x4
--
Summary: arm-elf-gcc 3.4.0 problems when generating code for
__attribute__ ((interrupt ("IRQ")))
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bob at cnxtech dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i686-pc-cygwin
GCC target triplet: arm-elf-gcc
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16634
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2010-01-09 23:27 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-16634-8979@http.gcc.gnu.org/bugzilla/>
2006-08-08 23:05 ` [Bug target/16634] arm-elf-gcc problems when generating code for __attribute__ ((interrupt ("IRQ"))) pbrook at gcc dot gnu dot org
2006-08-08 23:47 ` pbrook at gcc dot gnu dot org
2006-09-11 10:41 ` rearnsha at gcc dot gnu dot org
2006-09-11 11:31 ` tbm at cyrius dot com
2006-11-14 16:28 ` tla at thrane dot com
2007-01-04 0:10 ` pbrook at gcc dot gnu dot org
2007-05-03 2:14 ` david+gcc at porkrind dot org
2007-08-06 9:08 ` sgh at sgh dot dk
2007-11-08 21:42 ` ralf dot guetlein at web dot de
2008-02-07 13:55 ` mmz at gmx dot net
2009-02-12 21:58 ` sgh at sgh dot dk
2010-01-09 23:27 ` ramana at gcc dot gnu dot org
2004-07-19 19:27 [Bug c/16634] New: arm-elf-gcc 3.4.0 " bob at cnxtech dot com
2004-10-07 16:14 ` [Bug target/16634] arm-elf-gcc " pinskia at gcc dot gnu dot org
2005-07-02 1:31 ` pinskia 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).