www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4414] New: [ICE] Taking item of static array returned by function

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

           Summary: [ICE] Taking item of static array returned by function
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2010-07-01 16:13:32 PDT ---
int[1] foo() {
    return [0];
}
void main() {
    int x = foo()[0];
}


DMD 2.047 gives:
Internal error: ..\ztc\cgcs.c 359

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 01 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4414


Don <clugdbug yahoo.com.au> changed:

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


--- Comment #1 from Don <clugdbug yahoo.com.au> 2010-07-27 00:28:48 PDT ---
*** Issue 4515 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: -------
Jul 27 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4414


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2010-08-29
19:52:03 PDT ---
This passes:

import std.stdio : writeln;

int[1] foo() 
{
    return [0];
}

void main() 
{
    int x = foo()[0];
    writeln(typeid(x));  // writes int
    //~ writeln(x);
}

But if I uncomment the last line then I get a different error:
Internal error: ..\ztc\cod2.c 4494

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



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2010-08-29
19:52:22 PDT ---
I forgot to mention this is on 2.048.

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


Per Ångström <d-bugzilla autark.se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |d-bugzilla autark.se


--- Comment #4 from Per Ångström <d-bugzilla autark.se> 2010-11-16 03:41:16 PST
---
(Digital Mars D Compiler v2.050)
I have a variation on this theme:
int f(lazy int[2] iarr) {
    return iarr[1];
}

void main() {
    int[2] iarr;
    f(iarr);
}

Internal error: ../ztc/cgcs.c 359

It works if I remove the lazy keyword. Of course, lazy is quite meaningless in
this context, but anyhow.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 16 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4414



--- Comment #5 from kennytm gmail.com 2011-03-19 16:47:22 PDT ---
*** Issue 5755 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: -------
Mar 19 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4414



--- Comment #6 from zetetyck gmail.com 2011-11-16 06:59:55 PST ---
To make searching easier, I just want to mention that with DMD 2.056, this
code:
int[1] foo() {
    return [0];
}
void main() {
    int x = foo()[0];
}

Now gives:
Internal error: ..\ztc\cgcs.c 352

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 16 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4414


Jonathan M Davis <jmdavisProg gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg gmx.com
           Severity|normal                      |critical


--- Comment #7 from Jonathan M Davis <jmdavisProg gmx.com> 2012-06-06 01:21:52
PDT ---
Still fails on pre-2.060 HEAD with

Internal error: backend/cgcs.c 343

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 06 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4414


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |blooh_ hotmail.com


--- Comment #8 from Don <clugdbug yahoo.com.au> 2012-09-13 07:49:33 PDT ---
*** Issue 8627 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: -------
Sep 13 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4414


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |peter.alexander.au gmail.co
                   |                            |m


--- Comment #9 from yebblies <yebblies gmail.com> 2012-12-27 00:39:58 EST ---
*** Issue 8159 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: -------
Dec 26 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4414


yebblies <yebblies gmail.com> changed:

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


--- Comment #10 from yebblies <yebblies gmail.com> 2012-12-27 00:40:35 EST ---
Same thing happens with slicing

ubyte[4] bytes()
{
    ubyte[4] x;
    return x;
}

void main()
{
    auto x = bytes()[0..4];
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 26 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4414


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com
           Platform|x86                         |All
         OS/Version|Windows                     |All


--- Comment #11 from Walter Bright <bugzilla digitalmars.com> 2013-04-07
01:13:14 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1858

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 07 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4414



--- Comment #12 from github-bugzilla puremagic.com 2013-04-07 03:11:56 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/024aa349664d7232056b7f28d07b6595c505d448
fix Issue 4414 - ICE(cgcs.c) Taking item of static array returned by function

https://github.com/D-Programming-Language/dmd/commit/aa767b0d7fe1616010a6caf205918f29aa4560a1
Merge pull request #1858 from WalterBright/fix4414

fix Issue 4414 - ICE(cgcs.c) Taking item of static array returned by function

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 07 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4414


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 07 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4414



--- Comment #13 from github-bugzilla puremagic.com 2013-04-07 10:56:01 PDT ---
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/11bf7c8071a058cb441163ee58a4daf3f4b86de4
Merge pull request #1858 from WalterBright/fix4414

fix Issue 4414 - ICE(cgcs.c) Taking item of static array returned by function

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