Bug 6736 – Regression(2.054): ICE (cgcod.c 1672) with alias this and certain structs

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-09-27T08:28:00Z
Last change time
2011-11-05T13:06:55Z
Keywords
accepts-invalid, diagnostic, patch, wrong-code
Assigned to
nobody
Creator
dlang-bugzilla

Comments

Comment #0 by dlang-bugzilla — 2011-09-27T08:28:32Z
struct S1 { struct S2 // must be 8 bytes in size { uint a, b; } S2 s2; alias s2 this; } void test() { S1 c; c = c + c; } I'm not sure what's going on - particularly why this even gets to the backend.
Comment #1 by hoganmeier — 2011-11-03T09:27:13Z
Doesn't ICE with 2.056 anymore, but it compiles and produces senseless code: _Dmain: push RBP mov RBP,RSP sub RSP,8 lea RAX,-8[RBP] xor RCX,RCX mov [RAX],RCX lea RDX,-8[RBP] add RDX,-8[RBP] mov -8[RBP],RDX xor EAX,EAX leave ret
Comment #2 by k.hara.pg — 2011-11-03T21:17:15Z
This is a regression of fixing bug 6546. The expression c + c runs semantics with alias this expansion in this order: BinExp::op_overload( c + c ) BinExp::op_overload( c.s2 + c ) BinExp::op_overload( c.s2 + s.s2 ) // no operator overloading BinExp::typeCombine( c.s2 + s.s2 ) // 1 BinExp::typeCombine( c.s2 + c ) // 2 BinExp::typeCombine( c + c ) // And BinExp::typeCombine cause error only when both types of sides are same. Therefore, typeCombine rejects #1, but not #2.
Comment #3 by k.hara.pg — 2011-11-03T21:22:59Z
Comment #4 by bugzilla — 2011-11-05T13:06:55Z