Mercurial > hg > CbC > CbC_gcc
diff gcc/testsuite/gdc.dg/pr90136a.d @ 152:2b5abeee2509
update gcc11
author | anatofuz |
---|---|
date | Mon, 25 May 2020 07:50:57 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gcc/testsuite/gdc.dg/pr90136a.d Mon May 25 07:50:57 2020 +0900 @@ -0,0 +1,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.attribute; + +@attribute("forceinline") 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); +}