Thread overview | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
August 03, 2014 [Issue 13244] Wrong code with -inline and foreach/map/all | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13244 --- Comment #1 from Vladimir Panteleev <thecybershadow@gmail.com> --- Reduced: //////////////// test.d /////////////// struct MapResult(alias fun) { @property empty() { return false; } void popFront() { } @property front() { return fun(0); } } auto map(alias fun)() { return MapResult!fun(); } void all(Range)(Range haystack) { foreach (e; haystack) if (e) return; } void main() { auto arr = [[1]]; foreach (ref x; arr) map!(c => x[c]).all; } /////////////////////////////////////// -- |
September 02, 2014 [Issue 13244] Wrong code with -inline and foreach/map/all | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13244 Denis Shelomovskij <verylonglogin.reg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |verylonglogin.reg@gmail.com --- Comment #2 from Denis Shelomovskij <verylonglogin.reg@gmail.com> --- Probably a duplicate of Issue 13083. -- |
October 13, 2014 [Issue 13244] Wrong code with -inline and foreach/map/all | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13244 Ola Østtveit <olaa81@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |olaa81@gmail.com --- Comment #3 from Ola Østtveit <olaa81@gmail.com> --- Similar issue with map/array: -- main.d -- import std.algorithm; import failsinline; void main() { auto fail = new FailsInline(); } -- main.d -- -- failsinline.d -- import std.algorithm; import std.array; void failsinline() { auto transform = (int i) => i; [0].map!transform.array; } -- failsinline.d -- 'rdmd main.d' works fine. 'rdmd -inline main.d' gives object.Error@(0): Access Violation. Removing the std.algorithm import from main.d makes it work fine. Same issue in dmd 2.066, 2.066-rc2 and 2.067-b1. -- |
December 18, 2014 [Issue 13244] Wrong code with -inline and foreach/map/all | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13244 Dragos Carp <dragoscarp@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dragoscarp@gmail.com -- |
July 02, 2015 [Issue 13244] Wrong code with -inline and foreach/map/all | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13244 --- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> --- Reduced case in comment #1 does not reproduce segfault with 2.068 git-head. Another reduction is: struct MapResult(alias fun) { int[] input; @property front() { return fun(input[0]); } } int[] array(R)(R r) { int[] a; a ~= r.front; return a; } void main() { auto arr = [[cast(ubyte)1]]; foreach (ref x; arr) { auto m = MapResult!(c => x[c])([0]); array(m); } } -- |
July 03, 2015 [Issue 13244] Wrong code with -inline and foreach/map/all | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13244 --- Comment #5 from Kenji Hara <k.hara.pg@gmail.com> --- (In reply to Kenji Hara from comment #4) > Reduced case in comment #1 does not reproduce segfault with 2.068 git-head. OK, I confirmed that the original issue might be a dup of issue 14366, but that fix (#PR 4505) had contained problem. void ToElemVisitor::visit(DotVarExp *) in e2ir.c elem *e = toElem(dve->e1, irs); Type *tb1 = dve->e1->type->toBasetype(); if (tb1->ty != Tclass && tb1->ty != Tpointer) e = addressElem(e, tb1); e = el_bin(OPadd, TYnptr, e, el_long(TYsize_t, v->offset)); if (v->isRef() || v->isOut()) // 14366 fix e = el_una(OPind, TYptr, e); // Line 3367 e = el_una(OPind, totym(dve->type), e); if (tybasic(e->Ety) == TYstruct) { e->ET = Type_toCtype(dve->type); } el_setLoc(e,dve->loc); result = e; At the line 3367, the indirection result is typed as TYptr - it's wrong. In 32bit/64 code gen, we should use TYnptr. By the difference, the indirection result will be stored in 16bit size register, and then the corrupted pointer will cause Access Violation. -- |
July 03, 2015 [Issue 13244] Wrong code with -inline and foreach/map/all | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13244 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #6 from Kenji Hara <k.hara.pg@gmail.com> --- https://github.com/D-Programming-Language/dmd/pull/4796 -- |
July 03, 2015 [Issue 13244] Wrong code with -inline and foreach/map/all | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13244 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |maor@weka.io --- Comment #7 from Kenji Hara <k.hara.pg@gmail.com> --- *** Issue 13083 has been marked as a duplicate of this issue. *** -- |
August 30, 2015 [Issue 13244] Wrong code with -inline and foreach/map/all | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13244 github-bugzilla@puremagic.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED -- |
August 30, 2015 [Issue 13244] Wrong code with -inline and foreach/map/all | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13244 --- Comment #8 from github-bugzilla@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/7dd243d69d4d2525eebc7e73f94f9df215fbeb3a fix Issue 13244 - Wrong code with -inline and foreach/map/all https://github.com/D-Programming-Language/dmd/commit/a7717a0ee3708346d44f3b9ff237d18a4fedb549 Merge pull request #4796 from 9rnsr/fix13244 Issue 13244 - Wrong code with -inline and foreach/map/all -- |
Copyright © 1999-2021 by the D Language Foundation