What Every C Programmer Should Know About Undefined Behavior #1/3 - The LLVM Project Blog
People occasionally ask why LLVM-compiled code sometimes generates SIGTRAP signals when the optimizer is turned on. After digging in, they find that Clang generated a "ud2" instruction (assuming X86 code) - the same as is generated by __builtin_trap().
What Every C Programmer Should Know About Undefined Behavior #1/3 By Chris Lattner May 13, 2011 #optimization , #Clang 9 minute read People occasionally ask why LLVM-compiled code sometimes generates SIGTRAP signals when the optimizer is turned on. After digging in, they find that Clang generated a "ud2" instruction (assuming X86 code) - the same as is generated by __builtin_trap(). There are several issues at work here, all centering around undefined behavior in C code and how LLVM handles it. This blog post (the first in a series of three) tries to explain some of these issues so that you ca
saved by
related reading
- What Every C Programmer Should Know About Undefined Behavior #3/3 - The LLVM Project Blogblog.llvm.org
- What Every C Programmer Should Know About Undefined Behavior #2/3 - The LLVM Project Blogblog.llvm.org
- What even is compiler correctness?williamjbowman.com
- Undefined behavior, and the Sledgehammer Principle | The Pasturethephd.dev
- A Gentle Introduction to LLVM IR · mcyoungmcyoung.xyz
- Getting silly with C, part -5^-7 - lcamtuf’s thinglcamtuf.substack.com
- Zig: Already More Knowable Than C - Andrew Kelleyandrewkelley.me
- A Gentle Introduction to LLVM IR · mcyoungmcyoung.xyz
- The LLVM Compiler Infrastructure Projectllvm.org
- The Lost Art of Structure Packingcatb.org
- Destroy All Values: Designing Deinitialization in Programming Languages - Faultloregankra.github.io
- Understanding static single assignment formsblog.yossarian.net