public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/42452]  New: The application stack can be corrupted when an interrupt occurs somewhere
@ 2009-12-21 21:19 cwang at rossvideo dot com
  2009-12-21 21:28 ` [Bug c/42452] " cwang at rossvideo dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: cwang at rossvideo dot com @ 2009-12-21 21:19 UTC (permalink / raw)
  To: gcc-bugs

The options given when GCC was configured/built:
Using built-in specs.
Target: arm-none-eabi
Configured with: /scratch/julian/2009q3-respin-eabi-lite/src/gcc-4.4/configure
--build=i686-pc-linux-gnu --host=i686-min
gw32 --target=arm-none-eabi --enable-threads --disable-libmudflap
--disable-libssp --disable-libstdcxx-pch --enable-extr
a-sgxxlite-multilibs --with-gnu-as --with-gnu-ld
--with-specs='%{O2:%{!fno-remove-local-statics: -fremove-local-statics}
} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics:
-fremove-local-statics}}}' --enable-languages=c,c++ --disable-shar
ed --disable-lto --with-newlib --with-pkgversion='Sourcery G++ Lite 2009q3-68'
--with-bugurl=https://support.codesourcer
y.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-headers=yes
--with-sysroot=/opt/codesourcery/arm-non
e-eabi
--with-build-sysroot=/scratch/julian/2009q3-respin-eabi-lite/install/host-i686-mingw32/arm-none-eabi
--with-libic
onv-prefix=/scratch/julian/2009q3-respin-eabi-lite/obj/host-libs-2009q3-68-arm-none-eabi-i686-mingw32/usr
--with-gmp=/sc
ratch/julian/2009q3-respin-eabi-lite/obj/host-libs-2009q3-68-arm-none-eabi-i686-mingw32/usr
--with-mpfr=/scratch/julian/
2009q3-respin-eabi-lite/obj/host-libs-2009q3-68-arm-none-eabi-i686-mingw32/usr
--with-ppl=/scratch/julian/2009q3-respin-
eabi-lite/obj/host-libs-2009q3-68-arm-none-eabi-i686-mingw32/usr
--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lst
dc++,-Bdynamic -lm'
--with-cloog=/scratch/julian/2009q3-respin-eabi-lite/obj/host-libs-2009q3-68-arm-none-eabi-i686-ming
w32/usr --disable-libgomp --enable-poison-system-directories
--with-build-time-tools=/scratch/julian/2009q3-respin-eabi-
lite/obj/tools-i686-pc-linux-gnu-2009q3-68-arm-none-eabi-i686-mingw32/arm-none-eabi/bin
--with-build-time-tools=/scratch
/julian/2009q3-respin-eabi-lite/obj/tools-i686-pc-linux-gnu-2009q3-68-arm-none-eabi-i686-mingw32/arm-none-eabi/bin
Thread model: single
gcc version 4.4.1 (Sourcery G++ Lite 2009q3-68)


0011c6d0 <getFPGARefRate>:
  11c6d0:       b510            push    {r4, lr}
  11c6d2:       b082            sub     sp, #8
  11c6d4:       466c            mov     r4, sp
  11c6d6:       3406            adds    r4, #6
  11c6d8:       201d            movs    r0, #29
  11c6da:       1c21            adds    r1, r4, #0
  11c6dc:       2201            movs    r2, #1
  11c6de:       f7ff ff6f       bl      11c5c0 <readFPGA>
  11c6e2:       b002            add     sp, #8
  11c6e4:       8820            ldrh    r0, [r4, #0]
  11c6e6:       bc10            pop     {r4}
  11c6e8:       bc02            pop     {r1}
  11c6ea:       4708            bx      r

The returned value (r0) of the above function will be overwritten when an
interrupt occurs between address 11c6e2 and address 11c6e4 and the interrupt
service routine shares same stack with the above function. I think the quick
fix is to swap the instructions between address 11c6e2 and address 11c6e4.


-- 
           Summary: The application stack can be corrupted when an interrupt
                    occurs somewhere
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: cwang at rossvideo dot com
  GCC host triplet: Windows or CygWin
GCC target triplet: ARM Thumb


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


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

* [Bug c/42452] The application stack can be corrupted when an interrupt occurs somewhere
  2009-12-21 21:19 [Bug c/42452] New: The application stack can be corrupted when an interrupt occurs somewhere cwang at rossvideo dot com
@ 2009-12-21 21:28 ` cwang at rossvideo dot com
  2009-12-21 21:45 ` [Bug target/42452] " pinskia at gcc dot gnu dot org
  2009-12-21 21:47 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: cwang at rossvideo dot com @ 2009-12-21 21:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from cwang at rossvideo dot com  2009-12-21 21:27 -------
Actually, The value which r4 points to in the above function will be corrupted
when an interrupt occurs between address 11c6e2 and address 11c6e4 and the
interrupt service routine shares a same stack with the above function.


-- 


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


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

* [Bug target/42452] The application stack can be corrupted when an interrupt occurs somewhere
  2009-12-21 21:19 [Bug c/42452] New: The application stack can be corrupted when an interrupt occurs somewhere cwang at rossvideo dot com
  2009-12-21 21:28 ` [Bug c/42452] " cwang at rossvideo dot com
@ 2009-12-21 21:45 ` pinskia at gcc dot gnu dot org
  2009-12-21 21:47 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-12-21 21:45 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal
          Component|c                           |target
           Keywords|                            |wrong-code


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


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

* [Bug target/42452] The application stack can be corrupted when an interrupt occurs somewhere
  2009-12-21 21:19 [Bug c/42452] New: The application stack can be corrupted when an interrupt occurs somewhere cwang at rossvideo dot com
  2009-12-21 21:28 ` [Bug c/42452] " cwang at rossvideo dot com
  2009-12-21 21:45 ` [Bug target/42452] " pinskia at gcc dot gnu dot org
@ 2009-12-21 21:47 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-12-21 21:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2009-12-21 21:46 -------


*** This bug has been marked as a duplicate of 38644 ***


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2009-12-21 21:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-21 21:19 [Bug c/42452] New: The application stack can be corrupted when an interrupt occurs somewhere cwang at rossvideo dot com
2009-12-21 21:28 ` [Bug c/42452] " cwang at rossvideo dot com
2009-12-21 21:45 ` [Bug target/42452] " pinskia at gcc dot gnu dot org
2009-12-21 21:47 ` 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).