[LLVMbugs] [Bug 19174] New: -O1 breaks std::abs

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Mar 18 10:33:33 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19174

            Bug ID: 19174
           Summary: -O1 breaks std::abs
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: quixote72 at hotmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The appended snippet, when compiled and executed thus:

  clang++ -o a.out t.cpp -O1 && ./a.out

produces the following output:

  z: -1372777060 abs(z): -1372777060

Removing -O1 results in the correct output. 

My clang version:

  Ubuntu clang version 3.5.0-1~exp1 (trunk) (based on LLVM 3.5.0)
  Target: x86_64-pc-linux-gnu
  Thread model: posix


#include <cmath>
#include <cstdlib>
#include <iostream>

int main ()
{
  int z = std::rand () * 4;
  std::cout << "z: " << z << " abs(z): " << std::abs (z) << std::endl;
  return 0;
}

-- 
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/20140318/d07789b2/attachment.html>


More information about the llvm-bugs mailing list