www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2560] New: ICE on invoking method that takes ref const struct parameter

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

           Summary: ICE on invoking method that takes ref const struct
                    parameter
           Product: D
           Version: 2.023
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: 2korden gmail.com


module bug;

struct S
{
    static S opCall()
    {
        S s;
        return s;
    }
}

void foo(ref const(S) s)
{
}

void bar()
{
    foo(S());
}

Output:
Internal error: ..\ztc\cod4.c 357

Note that this is a regression since DMD2.022


-- 
Jan 06 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2560


braddr puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |regression




-- 
Jan 06 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2560


ludwig informatik.uni-luebeck.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ludwig informatik.uni-
                   |                            |luebeck.de





-------
*** Bug 2561 has been marked as a duplicate of this bug. ***


-- 
Jan 07 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2560


spam extrawurst.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |spam extrawurst.org





Wow this one really sucks. For me this makes nearly every D2 using project
unbuildable since D2.023 ;(


-- 
Jan 07 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2560






Though I'm not sure why, I guess this is related:

struct Foo { 
    int x, y, z; 
    this(int dummy) {}
}

invariant(Foo) createFoo() {
    return cast(invariant) Foo(0);
}

void main() {
    auto foo = createFoo;
}

causes the same compilation error without the -inline option. Compiles OK if I
remove z, the constructor, or 'invariant' in the return type of createFoo.


-- 
Jan 07 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2560






-------
OK, it seems that the crash does not happen with DMD 2.026 anymore. Output is

crashes though. And another similar code snippet, too:

---
struct S { int x; }
const(S) f(){ return S(0); }
void g(){ int a = f().x; }
---


-- 
Mar 08 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2560


Don <clugdbug yahoo.com.au> changed:

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





*** Issue 2847 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 31 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2560


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikolalysenko gmail.com





*** Issue 2969 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 31 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2560






---

 *** Issue 2847 has been marked as a duplicate of this issue. ***
However I agree these issues are duplicate of this, don't forget specialty of real. In Issue 2847, only real causes ICE, besides float and double do not. Both const(struct) and const(real) may be behind assertion failure at cod4.c Bugs about real have harmful effects on numeric computing, so that this point must be important for you. -- 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=2560








 *** Issue 2847 has been marked as a duplicate of this issue. ***
However I agree these issues are duplicate of this, don't forget specialty of real. In Issue 2847, only real causes ICE, besides float and double do not. Both const(struct) and const(real) may be behind assertion failure at cod4.c Bugs about real have harmful effects on numeric computing, so that this point must be important for you.
The reason why it doesn't fail for float and double is that they have sizes of 4=int.sizeof and 8=long.sizeof, and get inlined at an earlier stage in the backend. So structs with size 1,2,4, and 8 are immune from the ICE. Real is size 10, so it ICEs. It's nothing to do with floating point at all. -- 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=2560






---

 The reason why it doesn't fail for float and double is that they have sizes of
 4=int.sizeof and 8=long.sizeof, and get inlined at an earlier stage in the
 backend. So structs with size 1,2,4, and 8 are immune from the ICE. Real is
 size 10, so it ICEs. It's nothing to do with floating point at all.
I am reassured by your good analysis. thank you. -- 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=2560


Walter Bright <bugzilla digitalmars.com> changed:

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





13:34:17 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