Jump to page: 1 2
Thread overview
[Issue 2560] New: ICE on invoking method that takes ref const struct parameter
Jan 07, 2009
d-bugmail
Jan 07, 2009
d-bugmail
Jan 07, 2009
d-bugmail
Jan 07, 2009
d-bugmail
Jan 07, 2009
d-bugmail
Mar 08, 2009
d-bugmail
[Issue 2560] ICE(cod4.c) on invoking method that takes ref const struct parameter
Aug 31, 2009
Don
Aug 31, 2009
Don
Aug 31, 2009
HOSOKAWA Kenchi
Aug 31, 2009
Don
Aug 31, 2009
HOSOKAWA Kenchi
Sep 03, 2009
Walter Bright
January 07, 2009
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


-- 

January 07, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2560


braddr@puremagic.com changed:

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




-- 

January 07, 2009
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




------- Comment #1 from ludwig@informatik.uni-luebeck.de  2009-01-07 04:16 -------
*** Bug 2561 has been marked as a duplicate of this bug. ***


-- 

January 07, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2560


spam@extrawurst.org changed:

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




------- Comment #2 from spam@extrawurst.org  2009-01-07 09:39 -------
Wow this one really sucks. For me this makes nearly every D2 using project unbuildable since D2.023 ;(


-- 

January 07, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2560





------- Comment #3 from dransic@free.fr  2009-01-07 16:48 -------
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.


-- 

March 08, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2560





------- Comment #4 from ludwig@informatik.uni-luebeck.de  2009-03-08 04:17 -------
OK, it seems that the crash does not happen with DMD 2.026 anymore. Output is instead analogous to the second case in #2561. The test case in #2665 still crashes though. And another similar code snippet, too:

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


-- 

August 31, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2560


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

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




--- Comment #5 from Don <clugdbug@yahoo.com.au>  2009-08-31 02:22:44 PDT ---
*** 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: -------
August 31, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2560


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

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




--- Comment #6 from Don <clugdbug@yahoo.com.au>  2009-08-31 02:25:02 PDT ---
*** 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: -------
August 31, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2560





--- Comment #7 from HOSOKAWA Kenchi <hskwk@inter7.jp>  2009-08-31 02:41:10 PDT ---
(In reply to comment #5)
> *** 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
35#.
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: -------
August 31, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2560





--- Comment #8 from Don <clugdbug@yahoo.com.au>  2009-08-31 02:52:15 PDT ---
(In reply to comment #7)
> (In reply to comment #5)
> > *** 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
> 35#.
> 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: -------
« First   ‹ Prev
1 2