[cfe-dev] Weird ud2 generation

David Chisnall via cfe-dev cfe-dev at lists.llvm.org
Mon Aug 15 00:59:17 PDT 2016


On 14 Aug 2016, at 19:59, Joerg Sonnenberger via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> On Sun, Aug 14, 2016 at 01:43:43PM -0500, via cfe-dev wrote:
>> I’m wondering if either a) someone recognizes this off the bat as
>> something Clang uses for some purpose, or b) if someone with more
>> experience with Clang, or the V8 codebase could help with solving?
>> The part where it’s related to the kernel version is what’s really throwing me off... 
> 
> ud2 is used for __builtin_trap() and a few other cases of implicit stop
> instructions. But the most likely candidate is the former. A good start
> for further debugging on your part is the -save-temps output. It should
> created annotated assembly, giving you some clue for where the
> instruction comes from.

The other use for ud2 is in code that the optimisers believe is unreachable (or, more accurately, only reachable as a result of undefined behaviour).  If you do madvise and then later do something that would only be valid if the return value is non-zero then you may end up with a ud2.

David



More information about the cfe-dev mailing list