public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "tda at ls83 dot eclipse.co.uk" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/47192] New: m68k target - gcc uses stack frame after it has been unlinked when compiling with -Os Date: Thu, 06 Jan 2011 15:56:00 -0000 [thread overview] Message-ID: <bug-47192-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47192 Summary: m68k target - gcc uses stack frame after it has been unlinked when compiling with -Os Product: gcc Version: 4.5.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned@gcc.gnu.org ReportedBy: tda@ls83.eclipse.co.uk Created attachment 22913 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22913 Testcase - Preprocessor output Attached test case produces code which ends with 61 003c 41EE FFFE lea (-2,%fp),%a0 30:gcc-bug.c **** return d; 31:gcc-bug.c **** } 62 .loc 1 32 0 63 0040 242E FFF8 move.l -8(%fp),%d2 64 0044 4E5E unlk %fp 30:gcc-bug.c **** return d; 65 .loc 1 30 0 66 0046 33D0 0000 move.w (%a0),stc.1197 66 0000 67 .loc 1 32 0 68 004c 4E75 rts If an interrupt occurs between the unlk and move.w, the variable pointed to by (a0) is corrupted prior to being copied. Compiling with -O1 keeps the lea and move.w together before the unlk, which is correct. Compiling with -O2 results in a move.w d1,stc.1197 after the unlk (contents of variable already in d1), so gets away with it. gcc output below and .i file attached. Problem also present in 4.5.1. m68k-elf-gcc -v -save-temps -c -g -gdwarf-2 -ffunction-sections -fdata-sections -Os -mcpu=51qe -Wall -Wa,-ahlms=gcc-bug.ls -I. -I/usr/local/gcc-m68k/m68k-elf/include gcc-bug.c Using built-in specs. COLLECT_GCC=m68k-elf-gcc COLLECT_LTO_WRAPPER=/usr/local/gcc-m68k-4.5.2/libexec/gcc/m68k-elf/4.5.2/lto-wrapper Target: m68k-elf Configured with: ../configure --target=m68k-elf --prefix=/usr/local/gcc-m68k-4.5.2 --enable-languages=c --with-newlib --disable-libssp --with-gnu-as --with-gnu-ld Thread model: single gcc version 4.5.2 (GCC) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-g' '-gdwarf-2' '-ffunction-sections' '-fdata-sections' '-Os' '-mcpu=51qe' '-Wall' '-I.' '-I/usr/local/gcc-m68k/m68k-elf/include' /usr/local/gcc-m68k-4.5.2/libexec/gcc/m68k-elf/4.5.2/cc1 -E -quiet -v -I. -I/usr/local/gcc-m68k/m68k-elf/include -imultilib m51qe gcc-bug.c -mcpu=51qe -Wall -ffunction-sections -fdata-sections -g -gdwarf-2 -fworking-directory -Os -fpch-preprocess -o gcc-bug.i ignoring nonexistent directory "/usr/local/gcc-m68k-4.5.2/lib/gcc/m68k-elf/4.5.2/../../../../m68k-elf/sys-include" #include "..." search starts here: #include <...> search starts here: . /usr/local/gcc-m68k/m68k-elf/include /usr/local/gcc-m68k-4.5.2/lib/gcc/m68k-elf/4.5.2/include /usr/local/gcc-m68k-4.5.2/lib/gcc/m68k-elf/4.5.2/include-fixed /usr/local/gcc-m68k-4.5.2/lib/gcc/m68k-elf/4.5.2/../../../../m68k-elf/include End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-g' '-gdwarf-2' '-ffunction-sections' '-fdata-sections' '-Os' '-mcpu=51qe' '-Wall' '-I.' '-I/usr/local/gcc-m68k/m68k-elf/include' /usr/local/gcc-m68k-4.5.2/libexec/gcc/m68k-elf/4.5.2/cc1 -fpreprocessed gcc-bug.i -quiet -dumpbase gcc-bug.c -mcpu=51qe -auxbase gcc-bug -g -gdwarf-2 -Os -Wall -version -ffunction-sections -fdata-sections -o gcc-bug.s GNU C (GCC) version 4.5.2 (m68k-elf) compiled by GNU C version 4.3.2, GMP version 4.2.2, MPFR version 2.3.1, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64520 GNU C (GCC) version 4.5.2 (m68k-elf) compiled by GNU C version 4.3.2, GMP version 4.2.2, MPFR version 2.3.1, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64520 Compiler executable checksum: 2edb184913810d520b23104a9f78d5ce COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-g' '-gdwarf-2' '-ffunction-sections' '-fdata-sections' '-Os' '-mcpu=51qe' '-Wall' '-I.' '-I/usr/local/gcc-m68k/m68k-elf/include' /usr/local/gcc-m68k-4.5.2/lib/gcc/m68k-elf/4.5.2/../../../../m68k-elf/bin/as -v -I. -I/usr/local/gcc-m68k/m68k-elf/include -mcpu=51qe -ahlms=gcc-bug.ls -o gcc-bug.o gcc-bug.s GNU assembler version 2.20 (m68k-elf) using BFD version (GNU Binutils) 2.20 COMPILER_PATH=/usr/local/gcc-m68k-4.5.2/libexec/gcc/m68k-elf/4.5.2/:/usr/local/gcc-m68k-4.5.2/libexec/gcc/m68k-elf/4.5.2/:/usr/local/gcc-m68k-4.5.2/libexec/gcc/m68k-elf/:/usr/local/gcc-m68k-4.5.2/lib/gcc/m68k-elf/4.5.2/:/usr/local/gcc-m68k-4.5.2/lib/gcc/m68k-elf/:/usr/local/gcc-m68k-4.5.2/lib/gcc/m68k-elf/4.5.2/../../../../m68k-elf/bin/ LIBRARY_PATH=/usr/local/gcc-m68k-4.5.2/lib/gcc/m68k-elf/4.5.2/m51qe/:/usr/local/gcc-m68k-4.5.2/lib/gcc/m68k-elf/4.5.2/../../../../m68k-elf/lib/m51qe/:/usr/local/gcc-m68k-4.5.2/lib/gcc/m68k-elf/4.5.2/:/usr/local/gcc-m68k-4.5.2/lib/gcc/m68k-elf/4.5.2/../../../../m68k-elf/lib/ COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-g' '-gdwarf-2' '-ffunction-sections' '-fdata-sections' '-Os' '-mcpu=51qe' '-Wall' '-I.' '-I/usr/local/gcc-m68k/m68k-elf/include'
next reply other threads:[~2011-01-06 15:32 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-01-06 15:56 tda at ls83 dot eclipse.co.uk [this message] 2011-01-06 19:38 ` [Bug target/47192] " mikpe at it dot uu.se
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-47192-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).