<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Malformed loop pragma crashes clang"
   href="http://llvm.org/bugs/show_bug.cgi?id=20069">20069</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Malformed loop pragma crashes clang
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>meheff@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=12675" name="attach_12675" title="crash report">attachment 12675</a> <a href="attachment.cgi?id=12675&action=edit" title="crash report">[details]</a></span>
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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>