public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/12084] New: 3.3.1 emitting strange stack handling code for ARM interrupts
@ 2003-08-28  1:12 jamesl at appliedminds dot com
  2003-08-28  1:12 ` [Bug c/12084] " jamesl at appliedminds dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jamesl at appliedminds dot com @ 2003-08-28  1:12 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12084

           Summary: 3.3.1 emitting strange stack handling code for ARM
                    interrupts
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jamesl at appliedminds dot com
                CC: gcc-bugs at gcc dot gnu dot org

The following was compiled with arm-elf-gcc -S -g -O2 -Wall -mcpu=arm7tdmi




void int_handler(void) __attribute__((interrupt("IRQ")));




void foo(void)


{


}




void int_handler(void)


{


    foo();


}




It emitted this assembly for int_handler:


int_handler:


.LFB5:


    .loc 1 8 0


    @ Interrupt Service Routine.


    @ args = 0, pretend = 0, frame = 0


    @ frame_needed = 1, uses_anonymous_args = 0


    str ip, [sp, #-4]!


    mov ip, sp


.LCFI0:


    stmfd   sp!, {r0, r1, r2, r3, fp, ip, lr, pc}


.LCFI1:


    sub fp, ip, #4


.LCFI2:


    .loc 1 9 0


    bl  foo


    ldmea   fp, {r0, r1, r2, r3, fp, sp, lr}


    ldmfd   sp!, {ip}


    subs    pc, lr, #4




1) The stack pointer is not being reset to its original location.


2) One of those ldm** needs a ^ after it to restore the correct CPSR.




This seems to be the same bug as in 3.2


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

* [Bug c/12084] 3.3.1 emitting strange stack handling code for ARM interrupts
  2003-08-28  1:12 [Bug c/12084] New: 3.3.1 emitting strange stack handling code for ARM interrupts jamesl at appliedminds dot com
@ 2003-08-28  1:12 ` jamesl at appliedminds dot com
  2003-08-28  1:13 ` jamesl at appliedminds dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jamesl at appliedminds dot com @ 2003-08-28  1:12 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12084



------- Additional Comments From jamesl at appliedminds dot com  2003-08-28 01:12 -------
Created an attachment (id=4667)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=4667&action=view)
C file show below with bug


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

* [Bug c/12084] 3.3.1 emitting strange stack handling code for ARM interrupts
  2003-08-28  1:12 [Bug c/12084] New: 3.3.1 emitting strange stack handling code for ARM interrupts jamesl at appliedminds dot com
  2003-08-28  1:12 ` [Bug c/12084] " jamesl at appliedminds dot com
@ 2003-08-28  1:13 ` jamesl at appliedminds dot com
  2003-08-29 16:22 ` [Bug target/12084] " pinskia at gcc dot gnu dot org
  2003-09-01  9:20 ` rearnsha at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jamesl at appliedminds dot com @ 2003-08-28  1:13 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12084



------- Additional Comments From jamesl at appliedminds dot com  2003-08-28 01:13 -------
Created an attachment (id=4668)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=4668&action=view)
Generated Assembler file from bug.c


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

* [Bug target/12084] 3.3.1 emitting strange stack handling code for ARM interrupts
  2003-08-28  1:12 [Bug c/12084] New: 3.3.1 emitting strange stack handling code for ARM interrupts jamesl at appliedminds dot com
  2003-08-28  1:12 ` [Bug c/12084] " jamesl at appliedminds dot com
  2003-08-28  1:13 ` jamesl at appliedminds dot com
@ 2003-08-29 16:22 ` pinskia at gcc dot gnu dot org
  2003-09-01  9:20 ` rearnsha at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-29 16:22 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12084


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target


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

* [Bug target/12084] 3.3.1 emitting strange stack handling code for ARM interrupts
  2003-08-28  1:12 [Bug c/12084] New: 3.3.1 emitting strange stack handling code for ARM interrupts jamesl at appliedminds dot com
                   ` (2 preceding siblings ...)
  2003-08-29 16:22 ` [Bug target/12084] " pinskia at gcc dot gnu dot org
@ 2003-09-01  9:20 ` rearnsha at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2003-09-01  9:20 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12084


rearnsha at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


------- Additional Comments From rearnsha at gcc dot gnu dot org  2003-09-01 09:20 -------
You are incorrect on both counts:

> 1) The stack pointer is not being reset to its original location.

Yes it is.  The first ldm reloads the stack pointer with the value it when 
    mov  ip, sp
was executed.  The second ldm pops the original ip value off the stack and
restores sp to the value it had before the interrupt was taken.

> 2) One of those ldm** needs a ^ after it to restore the correct CPSR.

No.  Neither of the ldm instructions restores the PC, so it must not use ^ or
it would end up accessing the user-bank register set.   Instead, the final
subs (note use of condition flag) instruction restores the CPSR.


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

end of thread, other threads:[~2003-09-01  9:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-28  1:12 [Bug c/12084] New: 3.3.1 emitting strange stack handling code for ARM interrupts jamesl at appliedminds dot com
2003-08-28  1:12 ` [Bug c/12084] " jamesl at appliedminds dot com
2003-08-28  1:13 ` jamesl at appliedminds dot com
2003-08-29 16:22 ` [Bug target/12084] " pinskia at gcc dot gnu dot org
2003-09-01  9:20 ` rearnsha 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).