OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [objc-foreach-5.m] - Blame information for rev 704

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 704 jeremybenn
/* FIXME: Run this test with the GNU runtime as well.  */
2
/* { dg-do compile { target *-*-darwin* } } */
3
/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
4
/* { dg-skip-if "No NeXT fast enum. pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
5
 
6
#import <Foundation/Foundation.h>
7
 
8
NSArray * createTestVictim(unsigned capacity) {
9
    NSMutableArray * arr = [[NSMutableArray alloc] initWithCapacity:capacity];
10
    int x = 0;
11
 
12
    for(x = 0; x < capacity; x++) {
13
        NSNumber * num = [NSNumber numberWithInteger:x];
14
        [arr addObject:num];
15
    }
16
 
17
    NSArray * immutableCopy = [arr copy];
18
    [arr release];
19
 
20
    return immutableCopy;
21
}
22
 
23
void addStuffUp(NSArray * values) {
24
    NSInteger accumulator = 0;
25
//    for (id item in values) {
26
    id item;
27
    for (item in values) {
28
        accumulator += [item integerValue];
29
    }
30
}
31
 
32
int main (int argc, char const* argv[]) {
33
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
34
    NSArray * target = createTestVictim(10);
35
    addStuffUp(target);
36
    [pool release];
37
    return 0;
38
}
39
/* { dg-final { scan-assembler "_addStuffUp:" } } */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.