Thread overview
[Issue 6736] New: ICE (cgcod.c 1672) with alias this and certain structs
Sep 27, 2011
Vladimir Panteleev
Nov 03, 2011
Trass3r
[Issue 6736] Regression(2.054): ICE (cgcod.c 1672) with alias this and certain structs
Nov 04, 2011
Kenji Hara
Nov 04, 2011
Kenji Hara
Nov 05, 2011
Walter Bright
September 27, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6736

           Summary: ICE (cgcod.c 1672) with alias this and certain structs
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-invalid-code
          Severity: minor
          Priority: P3
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: thecybershadow@gmail.com


--- Comment #0 from Vladimir Panteleev <thecybershadow@gmail.com> 2011-09-27 08:28:32 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 03, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6736


Trass3r <mrmocool@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ice-on-invalid-code         |accepts-invalid,
                   |                            |diagnostic, wrong-code
           Priority|P3                          |P2
                 CC|                            |mrmocool@gmx.de
           Platform|x86                         |All
         OS/Version|Windows                     |All
           Severity|minor                       |normal


--- Comment #1 from Trass3r <mrmocool@gmx.de> 2011-11-03 09:27:13 PDT ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 04, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6736


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE (cgcod.c 1672) with     |Regression(2.054): ICE
                   |alias this and certain      |(cgcod.c 1672) with alias
                   |structs                     |this and certain structs
           Severity|normal                      |regression


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2011-11-03 21:17:15 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 04, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6736


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2011-11-03 21:22:59 PDT ---
https://github.com/D-Programming-Language/dmd/pull/493

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 05, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6736


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2011-11-05 13:06:55 PDT ---
https://github.com/D-Programming-Language/dmd/commit/475bd326462105c4422921aa485aed276597940d

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------