[LLVMdev] LLVM 2.4 problem?

Tatu Vaajalahti tatuvaaj at mac.com
Tue Oct 14 05:02:39 PDT 2008


I don't know enough C to know for certain if this is a programmer or  
compiler error:

In a Objective-C source file I have:

static const char sessionEntriesKVO = ' ';

Later I use that variable as a ID by taking it's address like this:

[feedManager addObserver:self forKeyPath:@"sessionEntriesCount"  
options:0 context:&sessionEntriesKVO];

and later

if (aContext == &sessionEntriesKVO) {

With GCC 4.2 everything works as expected but with LLVM-GCC it seems  
that the optimizer does something strange to the sessionEntriesKVO  
variable (I get strange "unrecognized selector sent to instance..."  
errors at runtime that has nothing to do with the sessionEntriesKVO).

Removing the const keyword (or compiling with -O0) fixes the problem.

Tatu Vaajalahti
Tampere, Finland

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20081014/a79afc92/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2415 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20081014/a79afc92/attachment.bin>

More information about the llvm-dev mailing list