public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "ed at catmur dot co dot uk" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/26908] New: -g3 (-ggdb3) emits broken calls to asm-defined functions Date: Tue, 28 Mar 2006 18:29:00 -0000 [thread overview] Message-ID: <bug-26908-8392@http.gcc.gnu.org/bugzilla/> (raw) foo.c: asm ( ".globl bar\n\t" "bar:\n\t" "movl $5, %eax\n\t" "ret" ); main() { return bar(); } $ gcc -g2 foo.c; ./a.out; echo $? 5 $ gcc foo.c -g3; ./a.out; echo $? Segmentation fault 139 Disassembly of the a.out compiled with -g3 gives: (gdb) disass main Dump of assembler code for function main: 0x08048364 <main+0>: push %ebp 0x08048365 <main+1>: mov %esp,%ebp 0x08048367 <main+3>: sub $0x8,%esp 0x0804836a <main+6>: and $0xfffffff0,%esp 0x0804836d <main+9>: mov $0x0,%eax 0x08048372 <main+14>: add $0xf,%eax 0x08048375 <main+17>: add $0xf,%eax 0x08048378 <main+20>: shr $0x4,%eax 0x0804837b <main+23>: shl $0x4,%eax 0x0804837e <main+26>: sub %eax,%esp 0x08048380 <main+28>: call 0x4852 0x08048385 <main+33>: leave 0x08048386 <main+34>: ret End of assembler dump. Note the call to an invalid location; it is this that causes the segfault. Seen in the wild in tetex-3.0 (uses asm functions in metafont). Workaround: don't use -g3. I will attach gcc -g3 -S foo.c output. -- Summary: -g3 (-ggdb3) emits broken calls to asm-defined functions Product: gcc Version: 3.4.6 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ed at catmur dot co dot uk GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26908
next reply other threads:[~2006-03-28 18:29 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-03-28 18:29 ed at catmur dot co dot uk [this message] 2006-03-28 18:31 ` [Bug debug/26908] " ed at catmur dot co dot uk 2006-03-28 18:45 ` pinskia at gcc dot gnu dot org 2006-03-28 19:15 ` ed at catmur dot co dot uk 2008-11-21 1:29 ` pinskia at gcc dot gnu dot org 2008-11-21 2:17 ` zuogang at huawei dot com 2008-12-28 2:36 ` pinskia at gcc dot gnu dot org 2008-12-29 12:29 ` bonzini at gnu dot org 2008-12-29 12:31 ` bonzini at 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-26908-8392@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).