[Issue 5369] New: Segfault with pure auto function in separate module

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 24 02:04:09 PST 2010


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 at puremagic.com
        ReportedBy: stanislav.blinov at gmail.com


--- Comment #0 from Stanislav Blinov <stanislav.blinov at 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: -------


More information about the Digitalmars-d-bugs mailing list