Bug 1034 – regression: -inline -O run/o/odd_bug_09_A.d

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2007-03-07T17:07:00Z
Last change time
2015-06-09T05:15:03Z
Assigned to
dvdfrdmn
Creator
thomas-dloop

Comments

Comment #0 by thomas-dloop — 2007-03-07T17:07:57Z
# 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; # } gdmd-0.23 -inline -O run/o/odd_bug_09_A.d -ofx && ./x Error: AssertError Failure run/o/odd_bug_09_A.d(36) test case: http://dstress.kuehne.cn/run/o/odd_bug_09_A.d
Comment #1 by dvdfrdmn — 2007-07-22T10:44:26Z
Fixed in svn r131 / release 0.24. This is really just a workaround: SRA optimizations are disabled for structs that have anonymous unions. A better solution would be to create embedded UNION_TYPEs. Fix is in the GCC patch, so re-apply it before rebuilding.