public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "normvcr at telus dot net" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug inline-asm/48347] The wrong assembler code is emitted for my architecture Date: Wed, 30 Mar 2011 01:26:00 -0000 [thread overview] Message-ID: <bug-48347-4-XBE5sZ7ihb@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-48347-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48347 --- Comment #2 from Norman Goldstein <normvcr at telus dot net> 2011-03-30 00:16:54 UTC --- I installed and built the source RPM mediatomb-0.12.1-5.fc14.src.rpm, using the default compile flags, -g -O2, and this is fine, except that debugging was difficult, so I rebuilt using only -g. This is when the assembler complained: Quote: ../src/zmm/atomic.h: Assembler messages: ../src/zmm/atomic.h:81: Error: bad register name `%sil' Line 81 in atomic.h is the inline asm statement: Code: static inline bool atomic_dec(mt_atomic_t *at) { unsigned char c; __asm__ __volatile__( ASM_LOCK "decl %0; sete %1" :"=m" (at->x), "=g" (c) :"m" (at->x) :"cc" ); return (c!=0); } I edited the compile command, replacing, -c with -S, and .o with .asm, to take a look at the generated assembler code. Here is the relevant snippet: Code: # 81 "../src/zmm/atomic.h" 1 lock; decl (%eax); sete %sil Sure enough, the gcc inline module inserted a reference to the "%sil" register, which is not part of the x86 32-bit architecture. The only difference on the command line was the absence of the "-O2" flag. I did some more experimenting, and found that "-O1" produces proper code. Then I did a compile replacing "-O1" with all the implied optimization flags, but the .asm file had the improper reference to "%sil" ! The gcc documentation does explain that "-On" is not exactly equivalent to using the implied flags, and I guess that my experience, here, corroborates this.
next prev parent reply other threads:[~2011-03-30 0:17 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-03-30 0:17 [Bug inline-asm/48347] New: " normvcr at telus dot net 2011-03-30 0:50 ` [Bug inline-asm/48347] " normvcr at telus dot net 2011-03-30 1:26 ` normvcr at telus dot net [this message] 2011-03-30 9:26 ` rguenth at gcc dot gnu.org 2011-03-30 19:41 ` normvcr at telus dot net 2011-03-30 19:50 ` pinskia at gcc dot gnu.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-48347-4-XBE5sZ7ihb@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).