http://llvm.org/bugs/show_bug.cgi?id=21490
Bug ID: 21490
Summary: LTO treats ObjC @selector's as compile time constants,
which they are not
Product: new-bugs
Version: trunk
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
For static/global values initialized with @selector syntax, the link time
optimizer treats them as if they're compile-time constants. This is true for
OSX and iOS.
Compile this -O2 (or -O3) with & without -flto:
#include <stdio.h>
#import <Foundation/Foundation.h>
@interface MyInterface : NSObject
// This selector also exists on NSString, so it gets adjusted at load time
-(NSUInteger)length;
@end
static SEL MySel = @selector(length);
int main(int argc, const char * argv[]) {
if (@selector(length) != MySel) {
printf("LTO BUG!\n");
return -1;
}
return 0;
}
The workaround for this issue is to use sel_registerName("length") instead of
the @selector syntax, though this is much slower.
--
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