http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44786
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|-fcatch-undefined-behavior: |-fsanitize=undefined: Turn |Turn on runtime code |on runtime code generation |generation to check for |to check for undefined |undefined behavior |behavior --- Comment #7 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-11-08 13:21:54 UTC --- > It didn't get very far (haven't looked deeper yet): This PR is for implementing those checks in GCC. For things broken in GCC, you should open new PRs. BTW, Clang now supports all these checks: -fsanitize=alignment: Use of a misaligned pointer or creation of a misaligned reference. -fsanitize=divide-by-zero: Division by zero. -fsanitize=float-cast-overflow: Conversion to, from, or between floating-point types which would overflow the destination. -fsanitize=null: Use of a null pointer or creation of a null reference. -fsanitize=object-size: An attempt to use bytes which the optimizer can determine are not part of the object being accessed. The sizes of objects are determined using __builtin_object_size, and consequently may be able to detect more problems at higher optimization levels. -fsanitize=return: In C++, reaching the end of a value-returning function without returning a value. -fsanitize=shift: Shift operators where the amount shifted is greater or equal to the promoted bit-width of the left hand side or less than zero, or where the left hand side is negative. For a signed left shift, also checks for signed overflow in C, and for unsigned overflow in C++. -fsanitize=signed-integer-overflow: Signed integer overflow, including all the checks added by -ftrapv, and checking for overflow in signed division (INT_MIN / -1). -fsanitize=unreachable: If control flow reaches __builtin_unreachable. -fsanitize=vla-bound: A variable-length array whose bound does not evaluate to a positive value. -fsanitize=vptr: Use of an object whose vptr indicates that it is of the wrong dynamic type, or that its lifetime has not begun or has ended. Incompatible with -fno-rtti.