bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/10420] New: .p2align can generate non-NOPs on x86-64


From: anders at kaseorg dot com
Subject: [Bug gas/10420] New: .p2align can generate non-NOPs on x86-64
Date: 20 Jul 2009 18:11:02 -0000

By default on x86-64, gas uses 0f 1f 00 as a 3-byte NOP for alignment:

$ echo 'nop; .p2align 2' > test.s
$ as test.s -o test.o
$ objdump -d test.o | tail -n2
   0:   90                      nop
   1:   0f 1f 00                nopl   (%rax)

However, with some -mtune options, it can generate 8d 76 00 instead:

$ as -mtune=pentium test.s -o test.o
$ objdump -d test.o | tail -n2
   0:   90                      nop
   1:   8d 76 00                lea    0x0(%rsi),%esi

This instruction is not actually a NOP on x86-64!  It has the effect of clearing
the high 32 bits of %rsi (see also bug #10419).  This could lead to incorrect
code generation, even though -mtune is only supposed to affect optimization
decisions and not correctness.

-- 
           Summary: .p2align can generate non-NOPs on x86-64
           Product: binutils
           Version: 2.19
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: anders at kaseorg dot com
                CC: bug-binutils at gnu dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=10420

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]