www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2665] New: crash on certain const struct function return types

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2665

           Summary: crash on certain const struct function return types
           Product: D
           Version: 2.023
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-valid-code
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: spam extrawurst.org


struct S{
 byte[10] m_a; //byte[9] does not ice
}

S var;

const(S) getVar() //returning just S does not crash
{
 return var;
}

void main()
{
 const(S) foo = getVar();
}

crashes dmd with: Internal error: ..\ztc\cod4.c 357


-- 
Feb 14 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2665





------- Comment #1 from ludwig informatik.uni-luebeck.de  2009-02-15 02:13
-------
This is probably related to or a duplicate of #2560.


-- 
Feb 15 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2665


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kolos80 bk.ru




--- Comment #2 from Don <clugdbug yahoo.com.au>  2009-08-19 07:27:24 PDT ---
*** Issue 3203 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 19 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2665


HOSOKAWA Kenchi <hskwk inter7.jp> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hskwk inter7.jp




--- Comment #3 from HOSOKAWA Kenchi <hskwk inter7.jp>  2009-08-20 07:45:11 PDT
---
(In reply to comment #0)

here is (probably) another case of this problem.

struct A {}

struct B {
    const A a;
}

B f() {
    return B(A());
}

Internal error: ..\ztc\cod4.c 354   DMD2.031



"const(struct)" is the common component for the issues related to ICE(cod4.c)
35#.
Here is a list of problematic code:
In the function "cdeq" which generates code for an assignment

 sz = tysize[tyml];
 assert((int)sz > 0); <- failed this assertion.

where tyml is a type of lvalue, sz represents # of bytes to transfer.

This issue is apparently due to bypass of type-size{tysize} registration for
const(struct), besides registration for struct itself is done.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 20 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2665





--- Comment #4 from Don <clugdbug yahoo.com.au>  2009-08-26 00:56:09 PDT ---
(In reply to comment #3)
 "const(struct)" is the common component for the issues related to ICE(cod4.c)
 35#.
 Here is a list of problematic code:
 In the function "cdeq" which generates code for an assignment
 
  sz = tysize[tyml];
  assert((int)sz > 0); <- failed this assertion.
 
 where tyml is a type of lvalue, sz represents # of bytes to transfer.
 
 This issue is apparently due to bypass of type-size{tysize} registration for
 const(struct), besides registration for struct itself is done.

A variation of that test case is interesting: struct A {} struct B { const A a; } void f() { //A a; // ---- if you uncomment this, it doesn't ICE! B b = B(A()); } Comparing the intermediate code using elem_print(e); shows that there's a difference between the two cases by the start of codelem(). But there's no difference in the code generated by DeclarationExp::toElem() in e2ir.c. Somewhere between the two, an optimisation/rewriting step is performed in the correct case, but not in the ICE case. I haven't yet worked out where it happens. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 26 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2665





--- Comment #5 from Don <clugdbug yahoo.com.au>  2009-08-31 02:18:24 PDT ---
Like 2560, this is a regression between 2.022 and 2.023. It's clearly the same
bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 31 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2665


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |regression




-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 31 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2665


Walter Bright <bugzilla digitalmars.com> changed:

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




--- Comment #6 from Walter Bright <bugzilla digitalmars.com>  2009-09-03
13:35:07 PDT ---
Fixed dmd 2.032

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