Thread overview
[Issue 6295] New: DMD 2.054 segfaults
Jul 12, 2011
Puneet Goel
Jul 12, 2011
Puneet Goel
[Issue 6295] [Regression 2.054] Segfault in checkPurity() of template value parameter
Jul 12, 2011
kennytm@gmail.com
Jul 12, 2011
kennytm@gmail.com
Aug 02, 2011
Walter Bright
July 12, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6295

           Summary: DMD 2.054 segfaults
           Product: D
           Version: D2
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: puneet@coverify.org


--- Comment #0 from Puneet Goel <puneet@coverify.org> 2011-07-12 09:47:22 PDT ---
Here is a reduced test case. Compiles and runs fine with dmd-2.053, segfaults at compile stage for dmd 1.054. Compiles and runs fine with dmd-2.054 if I take out "size_t N" template parameter. Also compiles fine with 2.054 if printFoo is defined outside the main function.

import std.stdio;
struct Foo(IF, size_t N) {}
interface Bar {}
void main() {
  void printFoo(T: Foo!(IF, N), IF, size_t N)(T foo)
    if(is(IF == interface)) {
    writeln("Type: ", T.stringof);
  }
  Foo!(Bar, 1) foo;
  printFoo(foo);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 12, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6295


Puneet Goel <puneet@coverify.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|blocker                     |normal


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 12, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6295


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #1 from bearophile_hugs@eml.cc 2011-07-12 10:04:10 PDT ---
Simplified code:


struct Foo(int N) {}
void main() {
    void bar(T: Foo!(N), int N)(T) {}
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 12, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6295


kennytm@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code, patch
                 CC|                            |kennytm@gmail.com
            Summary|DMD 2.054 segfaults         |[Regression 2.054] Segfault
                   |                            |in checkPurity() of
                   |                            |template value parameter
           Severity|normal                      |regression


--- Comment #2 from kennytm@gmail.com 2011-07-12 10:48:23 PDT ---
DMD pull #242.

https://github.com/D-Programming-Language/dmd/pull/242

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 12, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6295



--- Comment #3 from bearophile_hugs@eml.cc 2011-07-12 12:11:47 PDT ---
(In reply to comment #2)
> DMD pull #242.
> 
> https://github.com/D-Programming-Language/dmd/pull/242

That was fast :-)

A limited form of typestate (see bug 4571 ) might help D user code avoid many
null reference bugs.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 12, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6295



--- Comment #4 from kennytm@gmail.com 2011-07-12 12:17:33 PDT ---
(In reply to comment #3)
> (In reply to comment #2)
> > DMD pull #242.
> > 
> > https://github.com/D-Programming-Language/dmd/pull/242
> 
> That was fast :-)
> 
> A limited form of typestate (see bug 4571 ) might help D user code avoid many
> null reference bugs.

Typestates in D cannot help NULL dereferencing bugs in DMD which is written in C++.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 02, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6295


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> 2011-08-01 21:45:25 PDT ---
https://github.com/D-Programming-Language/dmd/commit/1dac08b77af2826996567f629acf7f43d724cd48

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