Mercurial > hg > CbC > CbC_gcc
diff gcc/testsuite/g++.dg/ipa/ipa-icf-6.C @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children | 1830386684a0 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gcc/testsuite/g++.dg/ipa/ipa-icf-6.C Fri Oct 27 22:46:09 2017 +0900 @@ -0,0 +1,36 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -fdump-ipa-icf" } */ + +struct A { + A() {ptr=&b;} + A(const A &a) {ptr = &b;} + void test() { if (ptr != &b) __builtin_abort ();} + int b; + int *ptr; +}; + +A test1(A a) +{ + a.test(); + return a; +} +A test2(A a) +{ + a.test(); + return a; +} +__attribute__ ((noinline)) +static void +test_me (A (*t)(A)) +{ + struct A a, b=t(a); + b.test (); +} +int +main() +{ + test_me (test1); + test_me (test2); + return 0; +} +/* { dg-final { scan-ipa-dump-times "Unified; Wrapper has been created" 1 "icf" } } */