|
|
|
|
|
by thxg
1004 days ago
|
|
The article is very recent (September 2023 [1]), mentions that "rax is used to return integer values" in the SysV ABI (hence implicitly the 64-bit SysV ABI). Also confirmed in this excerpt: > Note that the top 56 bits in rax are not zeroed – they contain junk. This is fine b/c the compiler will only make callers check the lowest bit of a register for boolean operations. This is why changing the compiler’s “understanding” (ie the cast) is necessary. ... and yet, the function ABI is clearly i386 (fetching arguments from stack) and indeed everything is compiled with -m32 [2] (i.e. 32-bit SysV ABI). This is a strange contradiction in 2023. On the Intel/AMD side, x86_64 has been prevalent (and the default) for... more than 15 years? It does not invalidate the article's point. But it is slightly confusing.... [1] https://dxuuu.xyz/ [2] https://godbolt.org/z/ff8r44nKn |
|
On such architecture "casting to bool" would be free, but other, narrowing type conversions would not.