[LLVMbugs] [Bug 20069] New: Malformed loop pragma crashes clang

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 17 11:23:19 PDT 2014


            Bug ID: 20069
           Summary: Malformed loop pragma crashes clang
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: meheff at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12675
  --> http://llvm.org/bugs/attachment.cgi?id=12675&action=edit
crash report

It appears the recently added loop pragmas don't handle certain malformed
pragmas well.  The code below (note the double opening parens in the pragma)
causes clang to crash.  Just run as 'clang foo.cc'

void loop()
#pragma clang loop vectorize(()
  while (1) {}

It appears that inside of PragmaLoopHintHandler::HandlePragma(), the variable
Value which contains the token within the parens in the loop pragam is not
initialized if the token is not an identifier or numeric constant.  Code:

    Token Value;
    if (Tok.is(tok::identifier) || Tok.is(tok::numeric_constant))
      Value = Tok;
    ... Use Value ...

Crash report attached.

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/20140617/77f11995/attachment.html>

More information about the llvm-bugs mailing list