public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug inline-asm/56621] Misaligned stack with inline assembly Date: Thu, 14 Mar 2013 18:58:00 -0000 [thread overview] Message-ID: <bug-56621-4-JOPlorhtsQ@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-56621-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56621 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |jakub at gcc dot gnu.org Resolution| |INVALID --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-03-14 18:58:12 UTC --- No, that is just bogus inline asm, for multiple reasons. message_size is 32-bit, so using movq on it means you can end up with arbitrary garbage in the high 32-bits. E.g. I see: write(1, "test\n\0\0\0\5\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0005\27\202\351?\0\0\0"..., 4294967301) = -1 EFAULT (Bad address) where 4294967301 is 0x100000005. You'd want movl instead, which will zero the upper 32 bits. Also, nothing tells the compiler that the clobbered registers are clobbered before consuming the inputs, the compiler could assign one of the two inputs to the clobbered registers. Better just use long dummy; int dummy2; ... "=S" (dummy), "=d" (dummy2) ... : "0" (message), "1" (message_size) ... then you don't need to do any of the bogus moves first, the compiler will arrange all of that. Or why aren't you just using syscall function, or write?
next prev parent reply other threads:[~2013-03-14 18:58 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-03-14 18:32 [Bug inline-asm/56621] New: " auc42 at yahoo dot com 2013-03-14 18:58 ` jakub at gcc dot gnu.org [this message] 2013-03-14 20:01 ` [Bug inline-asm/56621] " auc42 at yahoo dot com
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-56621-4-JOPlorhtsQ@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).