www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5369] New: Segfault with pure auto function in separate module

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

           Summary: Segfault with pure auto function in separate module
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: stanislav.blinov gmail.com


--- Comment #0 from Stanislav Blinov <stanislav.blinov gmail.com> 2010-12-24
02:01:50 PST ---
When a module has a non-templated function that is pure and has auto result
type, and at least one parameter, compiler segfaults when compiling another
module that imports the first and invokes the function.

Test case:
---
module mod;

// parameter type doesn't matter,
// as long as there is at least one parameter
// and function is not templated
pure auto foo(bool b)
{
    return 1;
}

module main;
import mod;

void main()
{
    foo(true);
}
---
$ dmd -v test.d mod.d

binary    dmd
version   v2.051
config    /home/user/dmd.conf
parse     test
parse     mod
importall test
import    object    (/home/user/dmd2/src/druntime/import/object.di)
importall mod
semantic  test
semantic  mod
semantic2 test
semantic2 mod
semantic3 test
Segmentation fault

Removing pure or parameters or replacing auto with concrete type, or making
function templated, resolves segfault. If the function is defined and used in
the same module that is being compiled, segfault doesn't occur either.

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



--- Comment #1 from Stanislav Blinov <stanislav.blinov gmail.com> 2010-12-24
02:04:53 PST ---
Sorry, test.d should be main.d

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


Brad Roberts <braddr puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Platform|x86_64                      |x86


--- Comment #2 from Brad Roberts <braddr puremagic.com> 2011-02-06 15:39:11 PST
---
Mass migration of bugs marked as x86-64 to just x86.  The platform run on isn't
what's relevant, it's if the app is a 32 or 64 bit app.

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



--- Comment #3 from Don <clugdbug yahoo.com.au> 2011-02-10 12:41:17 PST ---
Not confirmed -- cannot reproduce on Windows. Maybe Linux-specific?
On Windows, I just get:
test.d(9): Error: forward reference to foo
But no segfault.

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


Walter Bright <bugzilla digitalmars.com> changed:

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


--- Comment #4 from Walter Bright <bugzilla digitalmars.com> 2012-01-28
15:15:24 PST ---
Cannot reproduce. Works on Windows, Linux and OS X.

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