You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am reporting a Clang compiler bug discovered during my research.
The test was conducted using the latest version (Clang 19.1.0)
This issue occurs when using the -masm=intel --save-temps flag.
Summary
Bug1: The bus occurs when a variable name matches register name, the compiled code accesses an incorrect memory address even in the PIE binaries.
Bug2: The bug occurs when a function name matches register name, the compiled code converts the call instruction into an indirect call.
Example Code
Below is an example that reproduces the issues.
In the code, the variable RAX is assigned a value 4, and the function RBX is called.
#include <stdio.h>
int RAX;
void RBX() { printf("hello world\n"); }
int main()
{
RAX = 4;
RBX();
return 0;
}
I am reporting a Clang compiler bug discovered during my research.
The test was conducted using the latest version (Clang 19.1.0)
This issue occurs when using the
-masm=intel --save-temps
flag.Below is an example that reproduces the issues.
In the code, the variable RAX is assigned a value 4, and the function RBX is called.
Bug 1
At address 0x1164, the mov instruction accesses the indirect meory instead the data RAX.
For further details, refer to issue [Clang] Intel Assembly Bug (Mishandle RIP-relative Addressing) #122093
Also, similar issues occur when I use vector registers like XMM0.
For further details, refer to issue [Clang] Intel Assembly Bug (Mishandle Vector Register Names) #122092
Bug 2
At address 0x116f, the call instruction has been converted into an indirect call.
For further details, refer to issue [Clang] Intel Assembly Bugs (Mishandle Labels) #122200
You can reproduce the result through Godbolt Compiler Explorer:
https://godbolt.org/z/7EefT3zW8
The text was updated successfully, but these errors were encountered: