Bug 10090 – Segfault "cannot get frame pointer to <function>"

Status
RESOLVED
Resolution
WORKSFORME
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2013-05-15T13:30:00Z
Last change time
2013-10-01T23:31:46Z
Keywords
ice
Assigned to
nobody
Creator
gdkslpmq

Comments

Comment #0 by gdkslpmq — 2013-05-15T13:30:06Z
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.
Comment #1 by gdkslpmq — 2013-05-15T13:35:26Z
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.
Comment #2 by ibuclaw — 2013-05-16T04:35:06Z
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.
Comment #3 by ibuclaw — 2013-05-16T04:37:27Z
(In reply to comment #2) > Looks to be a closure bug. closure / possibly call by alias bug.
Comment #4 by bugzilla — 2013-10-01T23:31:46Z
Both examples work without error for dmd 2.064 head.