1 /* FIXME: Run this test with the GNU runtime as well. */
2 /* { dg-do compile { target *-*-darwin* } } */
3 /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
5 #include <objc/objc-api.h>
6 #import <Foundation/Foundation.h>
8 NSArray * createTestVictim(unsigned capacity) {
9 NSMutableArray * arr = [[NSMutableArray alloc] initWithCapacity:capacity];
12 for(x = 0; x < capacity; x++) {
13 NSNumber * num = [NSNumber numberWithInteger:x];
17 NSArray * immutableCopy = [arr copy];
23 void addStuffUp(NSArray * values) {
24 NSInteger accumulator = 0;
25 // for (id item in values) {
27 for (item in values) {
28 accumulator += [item integerValue];
32 int main (int argc, char const* argv[]) {
33 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
34 NSArray * target = createTestVictim(10);
39 /* { dg-final { scan-assembler "_addStuffUp:" } } */