[LLVMbugs] [Bug 16733] New: Infinite loopo segfaults with optimisation level 1 and above

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jul 29 08:48:39 PDT 2013


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

            Bug ID: 16733
           Summary: Infinite loopo segfaults with optimisation level 1 and
                    above
           Product: clang
           Version: 3.1
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: troels.roennow at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

If the following code is compiled with optimisation level 1, 2 or 3, it
segfaults. With optimsation level 0 it hangs forever as it is supposed to.

ex.cpp:
-------
#include<iostream>

void test() {
  for(std::size_t n = 1; n < 4 ;++n ) 
    n >>=1; 
}

int main() {
  test();
}

Bash:
-----
$ clang++ -O1 ex.cpp -o program
$ ./program
Segmentation fault: 11
$ clang++ --version
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix

Note that the function call is essential. This code:

#include<iostream>

int main() {
  for(std::size_t n = 1; n < 4 ;++n ) 
    n >>=1; 
}

works.

-- 
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/20130729/bff4a1df/attachment.html>


More information about the llvm-bugs mailing list