import std.range, std.algorithm;
void main() {
auto arr1 = [1, 2, 3, 4, 5];
float[] f = [1, 2, 3, 4, 5];
auto ind = sort!((int a, int b) {
return f[a] > f[b];
})([1, 2, 3, 4, 5]);
auto result = indexed(arr1, ind);
}
$ dmd -inline test.d
/cis/home/dsimcha/dmd2/linux/bin64/../../src/phobos/std/range.d(5962): Error: function std.range.Indexed!(int[],SortedRange!(int[],__dgliteral1)).Indexed.save cannot get frame pointer to main
/cis/home/dsimcha/dmd2/linux/bin64/../../src/phobos/std/range.d(6001): Error: function std.range.Indexed!(int[],SortedRange!(int[],__dgliteral1)).Indexed.opSlice cannot get frame pointer to main
I can only reproduce this on Linux, only with -inline and only with the call to sort(), which isn't related in any obvious way. I can't reproduce it with GDC, meaning it's likely a backend bug. Therefore, my guess is that this bug is somehow related to Linux exception handling.
Comment #1 by hoganmeier — 2011-10-17T17:46:33Z
Created attachment 1040
DustMite'd testcase
FWIW here's a DustMite reduced testcase that gives one of the errors.
test.d(26): Error: function test.Indexed!(void[],SortedRange!(void[],__dgliteral1)).Indexed.opSlice cannot get frame pointer to main
Comment #2 by bugzilla — 2011-10-20T19:51:45Z
What a fantastically convoluted example :-(
Comment #3 by bugzilla — 2011-10-20T20:21:45Z
It shrinks down to this. Compile with -inline:
struct Foo(T)
{
Foo opSlice(size_t a, size_t b)
{
return Foo(_indices[a..b]);
}
T _indices;
}
struct SortedRange(alias pred)
{
SortedRange opSlice(size_t a, size_t b)
{
return SortedRange();
}
}
void main() {
auto ind = SortedRange!({ })();
auto a = Foo!(typeof(ind))();
}
It happens on Windows, too, and is not a backend bug.