[cfe-dev] -fcatch-undefined-behavior testing

Chris Lattner clattner at apple.com
Wed Dec 16 21:45:01 PST 2009


On Dec 16, 2009, at 4:21 PM, Jan 'RedBully' Seiffert wrote:

> 1. Nice!
> 
> 2.
> ....
> 804bc26:       0f 0b                   ud2a
> ....
> 804bd1f:       83 f8 02                cmp    $0x2,%eax
> 804bd22:       0f 87 63 01 00 00       ja     804be8b <main+0xecb>
> 804bd28:       83 f8 03                cmp    $0x3,%eax
> 804bd2b:       0f 87 f5 fe ff ff       ja     804bc26 <main+0xc66>
> ....
> 
> Thats what i get for defensiv coding? :(
> (after the first couple instances of stuff like this i stopped grepping for ud2a
> and it's addresses)
> 
> 3.
> Can clang/llvm use into (the only conditional trap on x86) for such things?
> Or int3? Should give a:
> SIGTRAP        5        Core    Trace/breakpoint trap
> Or drop you into the debugger.

Yes, it would be nice for the code generator to turn "branch + builtin trap" into "into" when possible.

-Chris



More information about the cfe-dev mailing list