Re: Gcc and undefined behavior
On 2014-04-24 22:04:40 +0300, Shachar Shemesh wrote:
> Following the discussion from a few days ago about Cava (C like language
> with no undefined behavior), gcc 4.9 is now out[1]. One of the changes
> there is a runtime check for undefined behavior. Just compile with
> -fsanitize=undefined, and your program will crash with log if it
> performs an operation that C/C++ considers to be undefined.
Not exactly. It will just output a diagnostic. You need gcc-snapshot
to use the no-recover option (like clang). Note also that it doesn't
check all UB's, e.g. not uninitialized variables... like clang.
I tried it on GNU MPFR a few days ago and everything was fine.
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Reply to: