www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9113] New: ICE(interpret.c): CTFE assignment to member of struct in union

reply d-bugmail puremagic.com writes:
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



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: -------
Dec 05 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9113




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: -------
Dec 05 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9113


Don <clugdbug yahoo.com.au> changed:

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



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: -------
Dec 05 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9113




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: -------
Dec 06 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9113




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: -------
Dec 15 2012
prev sibling parent d-bugmail puremagic.com writes:
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: -------
Feb 05 2013