-fcatch-undefined-behavior testing

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

-fcatch-undefined-behavior testing

Jan 'RedBully' Seiffert
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.

Greetings
        Jan

--
The Theorem Theorem: If If, Then Then.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: -fcatch-undefined-behavior testing

Chris Lattner

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
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev