public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/51863] New: invlpg with -masm=intel generates memory operand size error in assembly stage
@ 2012-01-15  8:06 th020394 at gmail dot com
  2012-01-15  8:27 ` [Bug inline-asm/51863] " th020394 at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: th020394 at gmail dot com @ 2012-01-15  8:06 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51863
           Summary: invlpg with -masm=intel generates memory operand size
                    error in assembly stage
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: inline-asm
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: th020394@gmail.com


The expected behavior would be to generate code analogous to that of the
default -masm=att, which uses no size prefixes to address the memory operand of
invlpg.

The actual behavior is that -masm=intel causes GCC to emit code that uses a
size prefix (like dword, byte, etc.) which causes an error in GAS when the code
is assembled.

The command that generates the error is:
gcc -masm=intel main.c

The same command without -masm=intel works.

Output of "gcc -v"
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6.1/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.6.1-9ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin
--enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686
--with-tune=generic --enable-checking=release --build=i686-linux-gnu
--host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)

The system type is Linux Mint 12, but I've found the same bug in i686-elf for
GCC 4.6.2.


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

* [Bug inline-asm/51863] invlpg with -masm=intel generates memory operand size error in assembly stage
  2012-01-15  8:06 [Bug inline-asm/51863] New: invlpg with -masm=intel generates memory operand size error in assembly stage th020394 at gmail dot com
@ 2012-01-15  8:27 ` th020394 at gmail dot com
  2012-01-15 10:08 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: th020394 at gmail dot com @ 2012-01-15  8:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Tyler Hardin <th020394 at gmail dot com> 2012-01-15 06:05:49 UTC ---
Created attachment 26328
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26328
A source file that generates the error.


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

* [Bug inline-asm/51863] invlpg with -masm=intel generates memory operand size error in assembly stage
  2012-01-15  8:06 [Bug inline-asm/51863] New: invlpg with -masm=intel generates memory operand size error in assembly stage th020394 at gmail dot com
  2012-01-15  8:27 ` [Bug inline-asm/51863] " th020394 at gmail dot com
@ 2012-01-15 10:08 ` pinskia at gcc dot gnu.org
  2012-01-15 11:17 ` th020394 at gmail dot com
  2012-01-15 11:26 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-15 10:08 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-15 08:27:04 UTC ---
I think you should use:
    asm("invlpg %0" :: "r"(pointer_to_page) : "memory");
Instead.  What GCC is doing is correct in that it outputs the byte/word/dword
correctly for -masm=intel.


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

* [Bug inline-asm/51863] invlpg with -masm=intel generates memory operand size error in assembly stage
  2012-01-15  8:06 [Bug inline-asm/51863] New: invlpg with -masm=intel generates memory operand size error in assembly stage th020394 at gmail dot com
  2012-01-15  8:27 ` [Bug inline-asm/51863] " th020394 at gmail dot com
  2012-01-15 10:08 ` pinskia at gcc dot gnu.org
@ 2012-01-15 11:17 ` th020394 at gmail dot com
  2012-01-15 11:26 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: th020394 at gmail dot com @ 2012-01-15 11:17 UTC (permalink / raw)
  To: gcc-bugs

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

Tyler Hardin <th020394 at gmail dot com> changed:

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

--- Comment #3 from Tyler Hardin <th020394 at gmail dot com> 2012-01-15 08:49:26 UTC ---
(In reply to comment #2)
> I think you should use:
>     asm("invlpg %0" :: "r"(pointer_to_page) : "memory");
> Instead.
invlpg only accepts memory operands. But, if I adapt your idea just a little,
it works:
    asm("invlpg [%0]" :: "r"(pointer_to_page) : "memory");

It would be nice if it would work without having to trick the compiler (telling
it I'm using a register but actually referencing memory), but it works now,
that's all I care about. Thanks.

> What GCC is doing is correct in that it outputs the byte/word/dword
> correctly for -masm=intel.
But why for -masm=intel and not for -masm=att (the default)?


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

* [Bug inline-asm/51863] invlpg with -masm=intel generates memory operand size error in assembly stage
  2012-01-15  8:06 [Bug inline-asm/51863] New: invlpg with -masm=intel generates memory operand size error in assembly stage th020394 at gmail dot com
                   ` (2 preceding siblings ...)
  2012-01-15 11:17 ` th020394 at gmail dot com
@ 2012-01-15 11:26 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-15 11:26 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-15 10:08:04 UTC ---
(In reply to comment #3)
> > What GCC is doing is correct in that it outputs the byte/word/dword
> > correctly for -masm=intel.
> But why for -masm=intel and not for -masm=att (the default)?

Because that is how the constraint works.  In intel style, size prefix is part
of the memory and not the instruction.  That is mov with the size being in the
operand vs mov[lwqb] which says the size.


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

end of thread, other threads:[~2012-01-15 10:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-15  8:06 [Bug inline-asm/51863] New: invlpg with -masm=intel generates memory operand size error in assembly stage th020394 at gmail dot com
2012-01-15  8:27 ` [Bug inline-asm/51863] " th020394 at gmail dot com
2012-01-15 10:08 ` pinskia at gcc dot gnu.org
2012-01-15 11:17 ` th020394 at gmail dot com
2012-01-15 11:26 ` 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).