public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug inline-asm/48347] New: The wrong assembler code is emitted for my architecture @ 2011-03-30 0:17 normvcr at telus dot net 2011-03-30 0:50 ` [Bug inline-asm/48347] " normvcr at telus dot net ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: normvcr at telus dot net @ 2011-03-30 0:17 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48347 Summary: The wrong assembler code is emitted for my architecture Product: gcc Version: 4.5.1 Status: UNCONFIRMED Severity: critical Priority: P3 Component: inline-asm AssignedTo: unassigned@gcc.gnu.org ReportedBy: normvcr@telus.net Created attachment 23808 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23808 Complete output of compilation When using the flags "-g -O2", the right assembler code is emitted. When dropping the -O2, and using only "-g", the wrong assembler code is emitted. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug inline-asm/48347] The wrong assembler code is emitted for my architecture 2011-03-30 0:17 [Bug inline-asm/48347] New: The wrong assembler code is emitted for my architecture normvcr at telus dot net @ 2011-03-30 0:50 ` normvcr at telus dot net 2011-03-30 1:26 ` normvcr at telus dot net ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: normvcr at telus dot net @ 2011-03-30 0:50 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48347 --- Comment #1 from Norman Goldstein <normvcr at telus dot net> 2011-03-30 00:15:12 UTC --- Created attachment 23809 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23809 preporcessor output ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug inline-asm/48347] The wrong assembler code is emitted for my architecture 2011-03-30 0:17 [Bug inline-asm/48347] New: The wrong assembler code is emitted for my architecture 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 2011-03-30 9:26 ` rguenth at gcc dot gnu.org ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: normvcr at telus dot net @ 2011-03-30 1:26 UTC (permalink / raw) To: gcc-bugs 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. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug inline-asm/48347] The wrong assembler code is emitted for my architecture 2011-03-30 0:17 [Bug inline-asm/48347] New: The wrong assembler code is emitted for my architecture 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 @ 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 4 siblings, 0 replies; 6+ messages in thread From: rguenth at gcc dot gnu.org @ 2011-03-30 9:26 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48347 --- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-30 09:19:42 UTC --- I'm sure that sete doesn't work with any general operand. Use proper constraints. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug inline-asm/48347] The wrong assembler code is emitted for my architecture 2011-03-30 0:17 [Bug inline-asm/48347] New: The wrong assembler code is emitted for my architecture normvcr at telus dot net ` (2 preceding siblings ...) 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 4 siblings, 0 replies; 6+ messages in thread From: normvcr at telus dot net @ 2011-03-30 19:41 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48347 --- Comment #4 from Norman Goldstein <normvcr at telus dot net> 2011-03-30 19:35:48 UTC --- (In reply to comment #3) > I'm sure that sete doesn't work with any general operand. Use proper > constraints. You are right. sete must operate on an 8-bit register or an 8-bit memory location. GCC knows that the reference is to an 8-bit unsigned char, and GCC does the right thing under the "-g -O2" flags, so why not under the "-g" flag? I was not able to find a way to change the "=g" constraint to force GCC to use an 8-bit register/memory location. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug inline-asm/48347] The wrong assembler code is emitted for my architecture 2011-03-30 0:17 [Bug inline-asm/48347] New: The wrong assembler code is emitted for my architecture normvcr at telus dot net ` (3 preceding siblings ...) 2011-03-30 19:41 ` normvcr at telus dot net @ 2011-03-30 19:50 ` pinskia at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: pinskia at gcc dot gnu.org @ 2011-03-30 19:50 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48347 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |DUPLICATE --- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-03-30 19:41:02 UTC --- Use "=q" isntead of "=g". *** This bug has been marked as a duplicate of bug 10153 *** ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-03-30 19:41 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-03-30 0:17 [Bug inline-asm/48347] New: The wrong assembler code is emitted for my architecture 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 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
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).