Thread overview
[Issue 3668] New: foreach over typedef'd array crashes dmd
Jan 03, 2010
Stephan Dilly
Jan 04, 2010
Don
Jan 04, 2010
Stephan Dilly
Jan 04, 2010
Stephan Dilly
Jan 23, 2010
Walter Bright
Jan 31, 2010
Walter Bright
Jan 31, 2010
Don
January 03, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3668

           Summary: foreach over typedef'd array crashes dmd
           Product: D
           Version: 2.032
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-valid-code
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: spam@extrawurst.org


--- Comment #0 from Stephan Dilly <spam@extrawurst.org> 2010-01-03 15:00:13 PST ---
This code used to work up to version 2.031 without problems, since 2.032 it manages to crash dmd.

[CODE]
typedef byte[] Foo;

Foo bar;

foreach(value; bar){}
[/CODE]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 04, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3668


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |clugdbug@yahoo.com.au


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2010-01-04 07:24:58 PST ---
There's a missing toBaseType() in the Foreach code which was introduced in
D2.032.

PATCH:
statement.c, line 1525, in ForeachStatement::semantic():
------
        Identifier *id = Lexer::uniqueId("__aggr");
        ExpInitializer *ie = new ExpInitializer(loc, new SliceExp(loc, aggr,
NULL, NULL));
-        VarDeclaration *tmp = new VarDeclaration(loc,
aggr->type->nextOf()->arrayOf(), id, ie);
+        VarDeclaration *tmp = new VarDeclaration(loc,
aggr->type->toBasetype()->nextOf()->arrayOf(), id, ie);

        Expression *tmp_length = new DotIdExp(loc, new VarExp(loc, tmp),
Id::length);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 04, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3668


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrei@metalanguage.com
         Resolution|                            |WONTFIX


--- Comment #2 from Andrei Alexandrescu <andrei@metalanguage.com> 2010-01-04 08:47:18 PST ---
typedef is gone.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 04, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3668



--- Comment #3 from Stephan Dilly <spam@extrawurst.org> 2010-01-04 09:16:23 PST ---
huh ? it is gone ? in dmd 2.032 - 2.039 it is certainly not, otherwise the compiler would complain using it (puting this crash aside). since when is typedef gone and why ?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 04, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3668


Stephan Dilly <spam@extrawurst.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |


--- Comment #4 from Stephan Dilly <spam@extrawurst.org> 2010-01-04 09:19:18 PST ---
whatever is meant by "typedef is gone" the compiler should not crash under any circumstance. feel free to change the keywords to ice-on-invalid if that is the actual case.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 23, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3668


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com


--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> 2010-01-23 01:41:48 PST ---
Changeset 350

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 31, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3668



--- Comment #6 from Walter Bright <bugzilla@digitalmars.com> 2010-01-30 22:40:54 PST ---
fixed dmd 1.056 and 2.040

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 31, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3668


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

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


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