From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15279 invoked by alias); 8 Nov 2012 13:22:31 -0000 Received: (qmail 15089 invoked by uid 48); 8 Nov 2012 13:21:57 -0000 From: "manu at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/44786] -fsanitize=undefined: Turn on runtime code generation to check for undefined behavior Date: Thu, 08 Nov 2012 13:22:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: manu at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Summary Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-11/txt/msg00716.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D44786 Manuel L=C3=B3pez-Ib=C3=A1=C3=B1ez changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|-fcatch-undefined-behavior: |-fsanitize=3Dundefined: Tu= rn |Turn on runtime code |on runtime code generation |generation to check for |to check for undefined |undefined behavior |behavior --- Comment #7 from Manuel L=C3=B3pez-Ib=C3=A1=C3=B1ez 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=3Dalignment: Use of a misaligned pointer or creation of a misaligned reference. -fsanitize=3Ddivide-by-zero: Division by zero. -fsanitize=3Dfloat-cast-overflow: Conversion to, from, or between floating-point types which would overflow the destination. -fsanitize=3Dnull: Use of a null pointer or creation of a null referenc= e. -fsanitize=3Dobject-size: An attempt to use bytes which the optimizer c= an determine are not part of the object being accessed. The sizes of objects a= re determined using __builtin_object_size, and consequently may be able to det= ect more problems at higher optimization levels. -fsanitize=3Dreturn: In C++, reaching the end of a value-returning func= tion without returning a value. -fsanitize=3Dshift: 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=3Dsigned-integer-overflow: Signed integer overflow, includin= g all the checks added by -ftrapv, and checking for overflow in signed division (INT_MIN / -1). -fsanitize=3Dunreachable: If control flow reaches __builtin_unreachable. -fsanitize=3Dvla-bound: A variable-length array whose bound does not ev= aluate to a positive value. -fsanitize=3Dvptr: 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.