<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 --- - Clang hangs with Class string literal comparison"
   href="http://llvm.org/bugs/show_bug.cgi?id=15257">15257</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang hangs with Class string literal comparison
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dustin.clark@emerson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hi guys, this is kind of a weird issue discovered yesterday as a result of
updating a CI server with the latest version of Xcode. 

I've generalized what the team member was trying to do and while it's not
correct/ideal -- I don't imagine it's intended to cause a hangup.

$ cat bug.m
int main(int argc, const char * argv[])
{
    NSString *string = [[NSString alloc] init];
    if (string.class == @"NSString") NSLog(@"Foo");

    return 0;
}

With the older version:

$ clang --version
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix
$ clang -framework Cocoa bug.m -o bug


With the newer version:

$
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
--version
Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix
$
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-framework Cocoa bug.m -o bug
bug.m:6:19: warning: direct comparison of a string literal has undefined
behavior [-Wobjc-string-compare]
        if (string.class == @"NSString") NSLog(@"Foo");
                         ^  ~~~~~~~~~~~

And now clang is, indefinitely, hanging at 100% CPU. 

I've fixed the issue on our end by having them correctly use isKindOfClass or
NSStringFromClass :) -- but I thought I would file the bug incase it's unknown.

Thanks for your time -- and I sincerely apologize if this is a duplicate issue.

Regards,
Dusty</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>