www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10090] New: Segfault "cannot get frame pointer to <function>"

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

           Summary: Segfault "cannot get frame pointer to <function>"
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: gdkslpmq spam4.me


--- Comment #0 from Derek Rhodes <gdkslpmq spam4.me> 2013-05-15 13:30:06 PDT ---
This code

import std.functional;
import std.algorithm;

void main() {
    bool b = true;

    bool f(int) { return b; }

    filter!(not!f)([1]);
}

causes the compiler to segfault. I am using no compiler flags or options. I
have DMD64 D Compiler v2.062.

On a larger project with similar code, I get the error 

/usr/include/d/std/algorithm.d(1288): Error: constructor
std.algorithm.FilterResult!(not, ReadMacroPartialMatch[]).FilterResult.this
cannot get frame pointer to not
/usr/include/d/std/algorithm.d(1310): Error: function
std.algorithm.FilterResult!(not, ReadMacroPartialMatch[]).FilterResult.popFront
cannot get frame pointer to not
/usr/include/d/std/algorithm.d(1288): Error: constructor
std.algorithm.FilterResult!(not, ReadMacroPartialMatch[]).FilterResult.this
cannot get frame pointer to not
/usr/include/d/std/algorithm.d(1310): Error: function
std.algorithm.FilterResult!(not, ReadMacroPartialMatch[]).FilterResult.popFront
cannot get frame pointer to not

But I cannot figure out how to reproduce this error in a small example. I just
get the segfault on the example code I posted.

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



--- Comment #1 from Derek Rhodes <gdkslpmq spam4.me> 2013-05-15 13:35:26 PDT ---
This code

import std.functional;
import std.algorithm;

void main() {
    bool f(int) { return true; }

    filter!(not!f)([1]);
}

causes the error

/usr/include/d/std/algorithm.d(1288): Error: constructor
std.algorithm.FilterResult!(not, int[]).FilterResult.this cannot get frame
pointer to not
/usr/include/d/std/algorithm.d(1310): Error: function
std.algorithm.FilterResult!(not, int[]).FilterResult.popFront cannot get frame
pointer to not

But does not segfault. To my knowledge it should work.

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


Iain Buclaw <ibuclaw ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw ubuntu.com


--- Comment #2 from Iain Buclaw <ibuclaw ubuntu.com> 2013-05-16 04:35:06 PDT ---
Looks to be a closure bug.

ICE's in gdc also, backtrace:

#0 markAsNeedingClosure(f =
std.algorithm.FilterResult!(not,int[]).FilterResult.this, outerFunc = D main)
#1 checkEscapingSiblings(f = main.not!(f).not!(int).not, outerFunc = D main)
#2 checkEscapingSiblings(f = main.f, outerFunc = D main)
#3 FuncDeclaration::needsClosure(f = D main)
...

The loop condition in markAsNeedingClosure will keep looping until a null
pointer is dereferenced as std.algorithm.FilterResult is not lexically nested
inside D main.

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



--- Comment #3 from Iain Buclaw <ibuclaw ubuntu.com> 2013-05-16 04:37:27 PDT ---
(In reply to comment #2)
 Looks to be a closure bug.
closure / possibly call by alias bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 16 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10090


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> 2013-10-01
23:31:46 PDT ---
Both examples work without error for dmd 2.064 head.

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