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

            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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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:

    ...
    PP.Lex(Tok);
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to