public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "vincent dot riviere at freesbee dot fr" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/34947] New: Clobbered float registers not popped Date: Wed, 23 Jan 2008 20:58:00 -0000 [thread overview] Message-ID: <bug-34947-14645@http.gcc.gnu.org/bugzilla/> (raw) This problem is about functions that push some float registers at the beginning, but forget to pop them at the end. The stack pointer is not adjusted as expected, so the function return to an invalid address. It appears when the following is true: - the file is compiled with -m68020-60 -O1 -fomit-frame-pointer - the function uses floats - the function is complicated enough to have some float registers backed up on the stack - there is an early return in the function The problem appears in the following test case: $ cat bug.c volatile float g1; float g2; void f(void) { float i; if (g2 >= 0) return; for (i = 0; i < 10; ++i) g1 = g2 + i; } $ gcc -S bug.c -o - -m68020-60 -O2 -fomit-frame-pointer ... .globl f .type f, @function f: fmovm #0x4,-(%sp) fmove.s g2,%fp2 fbnge .L9 .L5: rts .L9: ... We can see that some float registers are backuped at the beginning. Then (g2 >= 0) is checked. If it is the case, the function returns with a simple rts, without restoring the registers, to an invalid address. This happens in gcc 4.2.2 and gcc-4.2-20080116 -- Summary: Clobbered float registers not popped Product: gcc Version: 4.2.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: vincent dot riviere at freesbee dot fr GCC target triplet: m68k-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34947
next reply other threads:[~2008-01-23 19:38 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-01-23 20:58 vincent dot riviere at freesbee dot fr [this message] 2008-02-02 19:15 ` [Bug c/34947] [4.2 Regression] " vincent dot riviere at freesbee dot fr 2008-02-21 7:35 ` vincent dot riviere at freesbee dot fr 2008-03-27 22:21 ` [Bug target/34947] " rguenth at gcc dot gnu dot org 2008-05-19 20:33 ` jsm28 at gcc dot gnu dot org 2009-03-31 15:03 ` jsm28 at gcc dot gnu dot org
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-34947-14645@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).