4 ms·
That's not what happened. You can reproduce what gcc does easily by trying to compile the following code: int f(int x) { return x | 256; } Gcc generates the
by rbehrends 9y ago
That's not what happened. You can reproduce what gcc does easily by trying to compile the following code:
int f(int x) { return x | 256; }
Gcc generates the following code:
movl %edi, %eax
orb $1, %ah
ret
In contrast, clang uses an orl instead of orb. The advantage of using orb is that it generates shorter code with an immediate operand. This is on an x86_64 architecture and does not involve 32-bit code.
- etatoby 9y agoMy point is that binary executables for Microsoft OSes, and the entire market built around them, are the only reason something like %ah (which is an incredibly stupid and expensive thing to address and the actual source of the bug) is part of the x86_64 architecture in the first place.
- striking 9y agoThat doesn't at all follow. Microsoft didn't invent the AH register.
- rbehrends 9y agoThat does not make sense. First, Windows in 64-bit mode does not even support running 16-bit applications. Second, there's plenty of 16-bit code that's completely unrelated to MS Office/Windows (such as MBRs; that's because the BIOS boot process requires real mode).
- IncRnd 9y agoThat isn't true. You can see that by this bug having been found on a system not running Windows.