[LLVMbugs] [Bug 23707] New: Code in the false branch of an "if" is executed

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat May 30 05:23:50 PDT 2015


            Bug ID: 23707
           Summary: Code in the false branch of an "if" is executed
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: paumard at users.sourceforge.net
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 14405
  --> https://llvm.org/bugs/attachment.cgi?id=14405&action=edit
test case


I downloaded llvm and clang today from svn trunk. I built it on Debian Jessie
(libc++ from GCC 4.9 provided by Debian).

When I build the attached code with -O1 or -O2 and then execute it, the code
fails with SIGFPE. The division by 0 is in the false branch of an "if", so this
code should not be executed.

The example is minimal: removing cerr output or uncommenting either of the
commented-out lines results in correct behaviour.

The issue is not present when compiling with -O0, with clang++-3.4 or 3.5, or
with g++.

The bug has been reported as a Debian bug first but is present in trunk:

Kind regards, Thibaut.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150530/c67ef358/attachment.html>

More information about the llvm-bugs mailing list