public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/29808]  New: [4.2 Regression] Error: suffix or operands invalid for `mov' when optimization is enabled
@ 2006-11-12  9:06 bero at arklinux dot org
  2006-11-12 11:10 ` [Bug inline-asm/29808] " segher at kernel dot crashing dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: bero at arklinux dot org @ 2006-11-12  9:06 UTC (permalink / raw)
  To: gcc-bugs

The following code (extracted from the Linux kernel) fails to compile with
optimization enabled:

static void load_fs(unsigned short sel)
{
        asm("mov %0, %%fs" : : "g"(sel));
}

int main(int argc, char **argv)
{
        load_fs(0);
}


[bero@dhcppc1 arklinux]$ gcc test.c
[bero@dhcppc1 arklinux]$ gcc -O1 test.c
/tmp/ccSpA5Rm.s: Assembler messages:
/tmp/ccSpA5Rm.s:13: Error: suffix or operands invalid for `mov'

gcc is 4.2 SVN revision 118519 (20061106).


-- 
           Summary: [4.2 Regression] Error: suffix or operands invalid for
                    `mov' when optimization is enabled
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bero at arklinux dot org
 GCC build triplet: i586-pc-linux-gnu
  GCC host triplet: i586-pc-linux-gnu
GCC target triplet: i586-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29808


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug inline-asm/29808] [4.2 Regression] Error: suffix or operands invalid for `mov' when optimization is enabled
  2006-11-12  9:06 [Bug inline-asm/29808] New: [4.2 Regression] Error: suffix or operands invalid for `mov' when optimization is enabled bero at arklinux dot org
@ 2006-11-12 11:10 ` segher at kernel dot crashing dot org
  2006-11-12 13:27 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: segher at kernel dot crashing dot org @ 2006-11-12 11:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from segher at kernel dot crashing dot org  2006-11-12 11:10 -------
Not a bug in GCC but in your code; "g" says immediate values
are allowed, while this asm insn only takes registers (or 16-bit
memory).


-- 

segher at kernel dot crashing dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |segher at kernel dot
                   |                            |crashing dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29808


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug inline-asm/29808] [4.2 Regression] Error: suffix or operands invalid for `mov' when optimization is enabled
  2006-11-12  9:06 [Bug inline-asm/29808] New: [4.2 Regression] Error: suffix or operands invalid for `mov' when optimization is enabled bero at arklinux dot org
  2006-11-12 11:10 ` [Bug inline-asm/29808] " segher at kernel dot crashing dot org
@ 2006-11-12 13:27 ` rguenth at gcc dot gnu dot org
  2006-11-12 13:40 ` bero at arklinux dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-11-12 13:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2006-11-12 13:26 -------
invalid


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29808


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug inline-asm/29808] [4.2 Regression] Error: suffix or operands invalid for `mov' when optimization is enabled
  2006-11-12  9:06 [Bug inline-asm/29808] New: [4.2 Regression] Error: suffix or operands invalid for `mov' when optimization is enabled bero at arklinux dot org
  2006-11-12 11:10 ` [Bug inline-asm/29808] " segher at kernel dot crashing dot org
  2006-11-12 13:27 ` rguenth at gcc dot gnu dot org
@ 2006-11-12 13:40 ` bero at arklinux dot org
  2006-11-12 14:01 ` segher at kernel dot crashing dot org
  2006-11-12 17:15 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: bero at arklinux dot org @ 2006-11-12 13:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from bero at arklinux dot org  2006-11-12 13:40 -------
If the code is invalid, the fact that it compiles with -O0 is probably a bug...


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29808


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug inline-asm/29808] [4.2 Regression] Error: suffix or operands invalid for `mov' when optimization is enabled
  2006-11-12  9:06 [Bug inline-asm/29808] New: [4.2 Regression] Error: suffix or operands invalid for `mov' when optimization is enabled bero at arklinux dot org
                   ` (2 preceding siblings ...)
  2006-11-12 13:40 ` bero at arklinux dot org
@ 2006-11-12 14:01 ` segher at kernel dot crashing dot org
  2006-11-12 17:15 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: segher at kernel dot crashing dot org @ 2006-11-12 14:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from segher at kernel dot crashing dot org  2006-11-12 14:01 -------
> If the code is invalid, the fact that it compiles with -O0 is probably a bug...

No, GCC cannot in general detect whether your asm code is buggy.
The assembler however can detect many asm bugs, as it did in this
case.

The reason it worked with -O0 is that with -O0 you get different
generated code (namely, very inefficient code).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29808


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug inline-asm/29808] [4.2 Regression] Error: suffix or operands invalid for `mov' when optimization is enabled
  2006-11-12  9:06 [Bug inline-asm/29808] New: [4.2 Regression] Error: suffix or operands invalid for `mov' when optimization is enabled bero at arklinux dot org
                   ` (3 preceding siblings ...)
  2006-11-12 14:01 ` segher at kernel dot crashing dot org
@ 2006-11-12 17:15 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-12 17:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2006-11-12 17:15 -------
(In reply to comment #3)
> If the code is invalid, the fact that it compiles with -O0 is probably a bug...
No it is not really a bug that it compiles at -O0 either becuase "g" means
"r"+"i" so the register allocator in the -O0 case is selecting "r" while in the
optimize case is selecting "i".


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29808


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-11-12 17:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-12  9:06 [Bug inline-asm/29808] New: [4.2 Regression] Error: suffix or operands invalid for `mov' when optimization is enabled bero at arklinux dot org
2006-11-12 11:10 ` [Bug inline-asm/29808] " segher at kernel dot crashing dot org
2006-11-12 13:27 ` rguenth at gcc dot gnu dot org
2006-11-12 13:40 ` bero at arklinux dot org
2006-11-12 14:01 ` segher at kernel dot crashing dot org
2006-11-12 17:15 ` pinskia at gcc dot gnu dot 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).