c++clangundefined-behaviorinstructions

Clang: How do I see where and why an ud2 instruction was generated?


In a really big project of mine, Clang seems to throw in ud2 instructions at some function calls. However, even with -Wall it doesn't seem to tell me why. I am using coroutines quite heavily in that project, but the ud2 instructions end up at non-coroutine function calls.

Thanks in advance
Tuxifan


Solution

  • Clang places ud2 instruction at whatever place that would be undefined behavior to reach. Doing this is not feasible.