[Bug c/43435] New: Bad registers are restored before ISR is leaved
karol_kostolny at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Mar 18 21:45:00 GMT 2010
Output of 'sh-elf-gcc -v -save-temps -O0 -m2a-nofpu -S -o tstint.asm tstint.c':
Using built-in specs.
Target: sh-elf
Configured with: ./gcc-4.3.4/configure --target=sh-elf --program-prefix=sh-elf-
--prefix=/opt/cross/sh-elf --disable-shared --with-multilib --disable-nls
--disable-libssp --enable-languages=c
Thread model: single
gcc version 4.3.4 (GCC)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O0' '-m2a-nofpu' '-S' '-o'
'tstint.asm'
/opt/cross/sh-elf/libexec/gcc/sh-elf/4.3.4/cc1 -E -quiet -v -imultilib m2
tstint.c -m2a-nofpu -O0 -fpch-preprocess -o tstint.i
ignoring nonexistent directory
"/opt/cross/sh-elf/lib/gcc/sh-elf/4.3.4/../../../../sh-elf/sys-include"
ignoring nonexistent directory
"/opt/cross/sh-elf/lib/gcc/sh-elf/4.3.4/../../../../sh-elf/include"
#include "..." search starts here:
#include <...> search starts here:
/opt/cross/sh-elf/lib/gcc/sh-elf/4.3.4/include
/opt/cross/sh-elf/lib/gcc/sh-elf/4.3.4/include-fixed
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O0' '-m2a-nofpu' '-S' '-o'
'tstint.asm'
/opt/cross/sh-elf/libexec/gcc/sh-elf/4.3.4/cc1 -fpreprocessed tstint.i -quiet
-dumpbase tstint.c -m2a-nofpu -auxbase-strip tstint.asm -O0 -version -o
tstint.asm
GNU C (GCC) version 4.3.4 (sh-elf)
compiled by GNU C version 4.4.1, GMP version 4.3.1, MPFR version
2.4.1-p2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 569db6a90945bcba0ab387b1b61a843e
COMPILER_PATH=/opt/cross/sh-elf/libexec/gcc/sh-elf/4.3.4/:/opt/cross/sh-elf/libexec/gcc/sh-elf/4.3.4/:/opt/cross/sh-elf/libexec/gcc/sh-elf/:/opt/cross/sh-elf/lib/gcc/sh-elf/4.3.4/:/opt/cross/sh-elf/lib/gcc/sh-elf/:/opt/cross/sh-elf/lib/gcc/sh-elf/4.3.4/../../../../sh-elf/bin/
LIBRARY_PATH=/opt/cross/sh-elf/lib/gcc/sh-elf/4.3.4/m2/:/opt/cross/sh-elf/lib/gcc/sh-elf/4.3.4/:/opt/cross/sh-elf/lib/gcc/sh-elf/4.3.4/../../../../sh-elf/lib/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O0' '-m2a-nofpu' '-S' '-o'
'tstint.asm'
Content of tstint.i:
# 1 "tstint.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "tstint.c"
#pragma interrupt
void test_interrupt()
{
(*((volatile unsigned int*) (0x01000000))) = 0x01000000;
(*((volatile unsigned int*) (0x02000000))) = 0x02000000;
}
int main(int argc, const char **argv)
{
return 0;
}
Code produced for test_interrupt() (tstint.asm produced) (regs r14, r1 and r2
saved, then r6, r5 and r14 restored before rte -> BAD!:
.global _test_interrupt
.type _test_interrupt, @function
_test_interrupt:
mov.l r14,@-r15
mov.l r1,@-r15
mov.l r2,@-r15
mov r15,r14
mov.l .L4,r2
mov.l .L4,r1
mov.l r1,@r2
mov.l .L6,r2
mov.l .L6,r1
mov.l r1,@r2
mov r14,r15
mov.l @r15+,r6
mov.l @r15+,r5
mov.l @r15+,r14
rte
nop
--
Summary: Bad registers are restored before ISR is leaved
Product: gcc
Version: 4.3.4
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: karol_kostolny at hotmail dot com
GCC build triplet: x86_64-linux-gnu
GCC host triplet: x86_64-linux-gnu
GCC target triplet: sh-unknown-elf
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43435
More information about the Gcc-bugs
mailing list