From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 128616 invoked by alias); 22 Oct 2015 08:19:17 -0000 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 Received: (qmail 128224 invoked by uid 48); 22 Oct 2015 08:19:12 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/68046] -ftrapv doesn't catch leaq-based overflows on x86-64 Date: Thu, 22 Oct 2015 08:19: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-Version: 5.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: DUPLICATE X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status resolution Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-10/txt/msg01807.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68046 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |DUPLICATE --- Comment #3 from Richard Biener --- If we have a variant that doesn't require libubsan (which is not available on all targets) then yes, that would indeed be nice. Of course it's restricted to the C family languages while -ftrapv was "working" for all languages before (though IIRC Ada has its own implementation). Note this bug may be a duplicate (and I must admit I didn't end up committing a few fixes I had for some of the -ftrapv bugs...). The testcase works in my dev tree: main: .LFB0: .cfi_startproc pushq %rbx .cfi_def_cfa_offset 16 .cfi_offset 3, -16 movq i(%rip), %rbx movl $1, %esi movq %rbx, %rdi call __addvdi3 cmpq %rax, %rbx setg %al movzbl %al, %eax popq %rbx .cfi_def_cfa_offset 8 ret > ./a.out Aborted Sorry about that... :/ (see PR61893) I'm going to re-test and commit the optab changes (which I believe triggers the above issue). *** This bug has been marked as a duplicate of bug 61893 ***