aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.dg/pr90136a.d
blob: e576fffec3d332342280dbf5113c432b6a13ba7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93038
// { dg-do compile }
// { dg-options "-fdump-tree-optimized" }
// { dg-final { scan-tree-dump-times "sum_array \\(array\\)" 0 "optimized"} }

import gcc.attributes;

@attribute("always_inline") int sum_array(int[] input);

int sum_array(int[] input)
{
    int sum = 0;
    foreach (elem; input)
        sum += elem;
    return sum;
}

int test(int[] array)
{
    return sum_array(array);
}