Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
%r11 clobbered by Lswitch in Linux AMD64 native-code compilation #4424
Original bug ID: 4424
When compiling the Lswitch instruction on a Linux AMD64, the %r11 register is first assigned the address of the label table, and then the table is jumped into. However, %r11 is also considered in register allocation. I have encountered a case where %r11 is selected for storing the table index used in the subsequent Lswitch, resulting in an immediate segmentation fault.
The generated code is:
Program received signal SIGSEGV, Segmentation fault.
Unfortunately, I cannot provide right now the source code that produces this as it is part of a large non-publicly available program. If required, I can try and extract a slice exposing the behavior (also this is not easy as it is probably highly dependent upon register allocation).