[llvm-bugs] [Bug 24807] clang++ -O1 evaluates wrong branch in C++ ternary operator ?:

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 14 16:21:03 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24807

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |richard-llvm at metafoo.co.uk
         Resolution|---                         |INVALID

--- Comment #6 from Richard Smith <richard-llvm at metafoo.co.uk> ---
>From the C standard:

"If part of a program tests floating-point status flags, sets floating-point
control modes, or runs under non-default mode settings, but was translated with
the state for the FENV_ACCESS pragma "off", the behavior is undefined."

Since the FENV_ACCESS pragma is not part of C++, and Clang's only supported
state for it is "off", and in any case you didn't use it, your call to
feenableexcept invokes undefined behavior.

Resolving invalid as your code invokes UB, but this is morally a duplicate of
bug 8100 (it would be a duplicate if you had used the necessary pragma).

-- 
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/20150914/7ed3a437/attachment-0001.html>


More information about the llvm-bugs mailing list