www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6781] New: Compiler Segfault on Complicated Nested Function Testcase

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

           Summary: Compiler Segfault on Complicated Nested Function
                    Testcase
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-valid-code
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dsimcha yahoo.com



test.d:

ubyte delegate() outer() {
    ubyte inner() {
        return typeof(return).init;
    }

    return &inner;
}

class C {
    uint[] sortedIndices;

    void makeSortedIndices() {
        auto comparator = outer();
        bool greater(uint index1, uint index2) {
            return comparator() == 1;
        }
        sort!greater(sortedIndices);
    }
}

void sort(alias comp, T)(T data) {
    T less;
    size_t lessI = size_t.max, greaterI = data.length - 1;
    less[ti] = data[0..min(lessI, greaterI + 1)];
}

$ dmd -c test.d -v 
binary    dmd
version   v2.055
config    /home/dsimcha/dmd2/linux/bin64/dmd.conf
parse     test
importall test
import    object       
(/home/dsimcha/dmd2/linux/bin64/../../src/druntime/import/object.di)
semantic  test
semantic2 test
semantic3 test
Segmentation fault

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ice-on-valid-code           |ice-on-invalid-code
                 CC|                            |clugdbug yahoo.com.au
            Summary|Compiler Segfault on        |Regression(2.055): Segfault
                   |Complicated Nested Function |with error in local alias
                   |Testcase                    |template



This is ice-on-invalid code. Reduced test case:

void bug6781(alias xxx)() {
    some_error;
}
struct C6781 {
    void makeSortedIndices() {
        int greater;
        bug6781!greater();
    }
}

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


Walter Bright <bugzilla digitalmars.com> changed:

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



12:18:02 PDT ---
https://github.com/D-Programming-Language/dmd/commit/6e4f808ca5b4d5222f2e1d677fd6f90fb02fe117

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