[llvm-bugs] [Bug 25895] New: clang generates infinite loop at -O2

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Dec 19 13:01:10 PST 2015


            Bug ID: 25895
           Summary: clang generates infinite loop at -O2
           Product: libraries
           Version: 3.7
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: daiweili at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Compiling this code on OSX using clang-3.7.0 with:
clang++ -c -O2 -std=c++11 -stdlib=libc++ -arch arm64 miscompile.cpp

results in code:

$ otool -tV miscompile.o | c++filt | grep -E "^0+([0-9a-f]+)\s+cbz.*\1$"
0000000000003700    cbz    x12, 0x3700

inside of the function Object::copyArrayData. It appears that the inlined
protoHasArray method is causing this code to be generated.

This also happens when generating x86 code:

00000000000032b0        testq   %rdi, %rdi
00000000000032b3        je      0x32b0

This doesn't happen with clang 3.6.2 or with a lower optimization level.

P.S.: Apologies for the giant input file. I couldn't find a way to reproduce
with a trivial example.

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/20151219/bb38d29b/attachment.html>

More information about the llvm-bugs mailing list