Mercurial > projects > dstress
changeset 1140:092188799a91
Incorrect code generation -O2 gdc
Johan Granberg <lijat.meREM@OVEgmail.com>
2006-09-14
news:eeb08s$2p5n$1@digitaldaemon.com
author | thomask |
---|---|
date | Thu, 14 Sep 2006 12:05:42 +0000 |
parents | 6c99a4ae5120 |
children | e00ecb270290 |
files | run/o/odd_bug_09_A.d run/o/odd_bug_09_B.d |
diffstat | 2 files changed, 84 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/o/odd_bug_09_A.d Thu Sep 14 12:05:42 2006 +0000 @@ -0,0 +1,42 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Johan Granberg <lijat.meREM@OVEgmail.com> +// @date@ 2006-09-14 +// @uri@ news:eeb08s$2p5n$1@digitaldaemon.com +// @desc@ Incorrect code generation -O2 gdc + +module dstress.run.o.odd_bug_09_A; + +struct S{ + union{ + void delegate(uint) del; + void function(uint) fp; + } + static S opCall(void function(uint) c,uint i){ + S a; + a.fp = c; + return a; + } +} + +S s; + +static this(){ + s = S(&foo, 0); +} + +void foo(uint i){ +} + +int main(){ + foo(0); + if(! s.fp){ + assert(0); + } + s.fp(0); + + return 0; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/o/odd_bug_09_B.d Thu Sep 14 12:05:42 2006 +0000 @@ -0,0 +1,42 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Johan Granberg <lijat.meREM@OVEgmail.com> +// @date@ 2006-09-14 +// @uri@ news:eeb08s$2p5n$1@digitaldaemon.com +// @desc@ Incorrect code generation -O2 gdc + +module dstress.run.o.odd_bug_09_B; + +struct S{ + union{ + void delegate(uint) del; + void function(uint) fp; + } + static S opCall(void function(uint) c,uint i){ + S a; + a.fp = c; + return a; + } +} + +S s; + +static this(){ + s.fp = &foo; +} + +void foo(uint i){ +} + +int main(){ + foo(0); + if(! s.fp){ + assert(0); + } + s.fp(0); + + return 0; +} +