[LLVMbugs] [Bug 18804] New: clang loop analyzer fails on some loops

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 11 04:35:30 PST 2014


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

            Bug ID: 18804
           Summary: clang loop analyzer fails on some loops
           Product: clang
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hlandau at devever.net
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12044
  --> http://llvm.org/bugs/attachment.cgi?id=12044&action=edit
Two test cases where clang loop analyzer fails

gcc4.8 can collapse some loops and clang can't.

The attached test case demonstrates an unusual use of for, if and switch
statements in a macro to define a new control flow statement. gcc 4.8 is
capable of completely collapsing the loops in this, whereas clang3.4 (and
presumably trunk) is not.

gcc's code is equivalent to
  if ((ec = f1()) < 0) return ec;
which is maximally efficient, whereas clang fails to collapse the loop.

Tested with -std=gnu11 -O2, -O3 on gcc4.8 and clang.

I asked in IRC and apparently this is a failure of the loop analyzer to analyze
the loop.

-- 
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/20140211/32febe29/attachment.html>


More information about the llvm-bugs mailing list