Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
March 27, 2013 [Issue 9822] New: cartesianProduct broken for array literals | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=9822 Summary: cartesianProduct broken for array literals Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: m.strashun@gmail.com --- Comment #0 from Dicebot <m.strashun@gmail.com> 2013-03-27 02:48:49 PDT --- Motivating code snippet: ----- module test; import std.algorithm, std.traits, std.stdio; enum r1 = [1, 2, 3]; auto product = cartesianProduct(r1, r1); void main() { writeln(product); } ----- Segmentation fault ----- What is expected: either working code, or compile-time error. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 27, 2013 [Issue 9822] cartesianProduct broken for array literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | http://d.puremagic.com/issues/show_bug.cgi?id=9822 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #1 from bearophile_hugs@eml.cc 2013-03-27 10:44:04 PDT --- A reduction: struct MapResult(alias fun) { int[] _input; @property bool empty() { return _input.length == 0; } void popFront() { _input = _input[1 .. $]; } @property auto ref front() { return fun(1); } } auto map(alias fun)(int[] r) { return MapResult!(fun)(r); } auto foo(int[] r) { return map!(x => r)([1]); } enum r1 = [1]; auto result = foo(r1); void main() { foreach (t; result) {} } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 28, 2013 [Issue 9822] cartesianProduct broken for array literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | http://d.puremagic.com/issues/show_bug.cgi?id=9822 --- Comment #2 from hsteoh@quickfur.ath.cx 2013-05-27 20:21:42 PDT --- Huh, this is really strange. Moving the cartesianProduct line inside main() makes the problem go away. Why? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 28, 2013 [Issue 9822] cartesianProduct broken for array literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | http://d.puremagic.com/issues/show_bug.cgi?id=9822 --- Comment #3 from hsteoh@quickfur.ath.cx 2013-05-27 21:19:14 PDT --- Hmph. I think this is a compiler bug. Putting the code inside a unittest block makes the problem go away too. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 28, 2013 [Issue 9822] Segfault when referencing module-global auto variable containing result of std.algorithm.map. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | http://d.puremagic.com/issues/show_bug.cgi?id=9822 hsteoh@quickfur.ath.cx changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code Summary|cartesianProduct broken for |Segfault when referencing |array literals |module-global auto variable | |containing result of | |std.algorithm.map. --- Comment #4 from hsteoh@quickfur.ath.cx 2013-05-27 21:40:27 PDT --- Retitled this bug based on bearophile's reduction, and comparison of the disassembly of buggy version (result assigned to module-global variable) vs. non-buggy version (result assigned to local variable); this looks like a wrong-code bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 28, 2013 [Issue 9822] Using module variable of templated type parametrized by lambda | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | http://d.puremagic.com/issues/show_bug.cgi?id=9822 Maxim Fomin <maxim@maxim-fomin.ru> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |maxim@maxim-fomin.ru Component|Phobos |DMD Summary|Segfault when referencing |Using module variable of |module-global auto variable |templated type parametrized |containing range that |by lambda |updates array literal | Severity|normal |critical --- Comment #5 from Maxim Fomin <maxim@maxim-fomin.ru> 2013-05-27 22:03:00 PDT --- Simplified: struct MapResult(alias fun) { @property auto ref front() { return fun(1); } } auto map(alias fun)() { return MapResult!(fun)(); } auto foo(int[] r) { return map!((int x) => r)(); } auto result = foo([1]); void main() { result.front(); } There is wrong-code on accessing or passing module object. It has nothing to do with auto or ranges. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation