Thread overview
[Issue 9113] New: ICE(interpret.c): CTFE assignment to member of struct in union
Dec 05, 2012
Don
Dec 05, 2012
Don
Dec 05, 2012
Don
Feb 05, 2013
Andrej Mitrovic
December 05, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9113

           Summary: ICE(interpret.c): CTFE assignment to member of struct
                    in union
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: clugdbug@yahoo.com.au


--- Comment #0 from Don <clugdbug@yahoo.com.au> 2012-12-05 00:22:34 PST ---
union U9113 {
   struct M {
        int y;
   }
   int xx;
}

int bug9113()
{
    U9113 x;
    x.M.y = 10;
    return 1;
}

static assert( bug9113() );
---
dmd: interpret.c:158: void CtfeStack::setValue(VarDeclaration*, Expression*):
Assertion `v->ctfeAdrOnStack >= 0 && v->ctfeAdrOnStack < stackPointer()'
failed.
Aborted

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



--- Comment #1 from Don <clugdbug@yahoo.com.au> 2012-12-05 02:14:37 PST ---
This is quite amazing, the semantic pass turns the function body into:
{
  U9113 x = 0;
  y = 10;
  return 1;
}

CTFE is complaining (correctly) that y was not declared. I'm not sure how this gets past code generation.

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


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2012-12-05 06:27:52 PST ---
https://github.com/D-Programming-Language/dmd/pull/1350

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 06, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9113



--- Comment #3 from github-bugzilla@puremagic.com 2012-12-06 08:07:43 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/058a16cdbbe9c32cd75b2a1ea2dbfb8a0bcc45d3 Fix issue 9113 ICE(interpret.c): CTFE assignment to member of struct in union

The ICE was caused by the error being detected too late. Move the "needs 'this'
pointer" error message from e2ir.c into semantic, instead of creating an
invalid
expression.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 15, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9113



--- Comment #4 from github-bugzilla@puremagic.com 2012-12-15 11:49:41 PST ---
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/4d4be85d488aaf2171a85de072370309483fdbb5 Fix issue 9113 ICE(interpret.c): CTFE assignment to member of struct in union

The ICE was caused by the error being detected too late. Move the "needs 'this'
pointer" error message from e2ir.c into semantic, instead of creating an
invalid
expression.

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


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich@gmail.com
         Resolution|                            |FIXED


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