www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10074] New: segfault in dmd

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

           Summary: segfault in dmd
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: jens.k.mueller gmx.de



The following program causes dmd (dmd2.062) to segfault on Linux.

template foo(F)                                                                 
{                                                                               
    enum foo = false;                                                           
}                                                                               

bool foo(F)(F f)                                                                
    if (foo!F)                                                                  
{                                                                               
    return false;                                                               
}                                                                               

void main()                                                                     
{                                                                               
    foo(1);                                                                     
}

$ dmd test.d
segmentation fault  dmd test.d

I expect the program to compile or abort with an error but there should be no
segfault.

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


Walter Bright <bugzilla digitalmars.com> changed:

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



20:16:59 PDT ---
It's actually a stack overflow, endlessly repeating:


expression.c:5018

sc=0x9fa2978,
    ti=0x9fa2858, dedtypes=0xff5ffa5c, fargs=0x0, flag=0) at template.c:928

s=0x8294908)
    at template.c:6522

s=0x8294908)
    at template.c:6434

    fp=0x818a945 <TemplateInstance::ParamNeedsInf::fp(void*, Dsymbol*)>) at
func.c:2446

sc=0x9fa2978, flag=0)
    at template.c:6548

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




20:50:09 PDT ---
It's looking at the constraint:

    if (foo!F)

recursively in attempting to see if the template instantiation needs type
inference.

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


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
            Version|unspecified                 |D2
           Severity|normal                      |regression



This is a regression issue from 2.061.

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

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




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/209c0d4f6b058472559d9ed3b8076bddf1e2c1e5
fix Issue 10074 - segfault in dmd

From 2.061, `deduceFunctionTemplate` has been using
TemplateDeclaration::matchWithInstance to do IFTI more strictly.
However, `matchWithInstance` does not detect the recursive template
instantiation inside template constraint, against
`deduceFunctionTemplateMatch`.

Duplicate the detection mechanism into `matchWithInstance`.

https://github.com/D-Programming-Language/dmd/commit/457acb1e03257fbff3ad52477d44d0d08ebb2d3e


[REG2.061] Issue 10074 - segfault in dmd

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


Walter Bright <bugzilla digitalmars.com> 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: -------
Oct 02 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10074


Kenji Hara <k.hara.pg gmail.com> changed:

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



*** Issue 11067 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: -------
Oct 10 2013