digitalmars.D.bugs - [Issue 9539] New: Regression (2.061): Wrong-code on static array pointer
- d-bugmail puremagic.com (35/38) Feb 19 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9539
- d-bugmail puremagic.com (51/63) Feb 20 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9539
- d-bugmail puremagic.com (10/10) Feb 21 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9539
- d-bugmail puremagic.com (8/8) Feb 21 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9539
- d-bugmail puremagic.com (11/12) Feb 21 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9539
- d-bugmail puremagic.com (9/9) Feb 21 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9539
- d-bugmail puremagic.com (8/8) Mar 01 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9539
- d-bugmail puremagic.com (10/10) Apr 10 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9539
- d-bugmail puremagic.com (10/10) Apr 11 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9539
- d-bugmail puremagic.com (10/10) May 13 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9539
http://d.puremagic.com/issues/show_bug.cgi?id=9539 Summary: Regression (2.061): Wrong-code on static array pointer Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: wrong-code Severity: regression Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: andrej.mitrovich gmail.com 14:13:47 PST --- void f(int** ptr) { assert(**ptr == 10); } void main() { int* i = new int; *i = 10; int*[1] x = [i]; f(&x[0]); } 2.060: $ dmd test.d2.061 $ dmd test.dcore.exception.AssertError test(5): Assertion failure2.062 $ dmd test.dcore.exception.AssertError test(5): Assertion failureSame thing happens when you use 'x.ptr'. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 19 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9539void f(int** ptr) { assert(**ptr == 10); } void main() { int* i = new int; *i = 10; int*[1] x = [i]; f(&x[0]); }More simple case: int*[1] x; int* p = new int; x = [p]; // is wrongly rewritten to: x[] = [p].ptr printf("p = %p, x[0] = %p\n", p, x[0]); assert(p == x[0]); // fails!? ---- This is horribly serious problem. The root issue is in TypeDArray::implicitConvTo. FROM THE BEGINNING of D2, an implicit conversion from dynamic array to its element pointer type as a deprecated feature. int[] arr; int* p; p = arr; // is expected to rewrite to p = arr.ptr BUT, it was completely broken FROM THE BEGINNING of D2. Instead of the expected behavior, dynamic array can be convertible to its element type. int*[] arr = [null]; int* p; p = arr; // bad! printf("p = %p, arr.ptr = %p\n", p, arr.ptr); It has been wrongly accepted in long time if '-d' switch is specified. Then, from 2.061, the situation has become worse by "informational deprecated error in default". Above code would be _silently_ accepted in default, and compiler outputs wrong-code. ---- But, we cannot *fix* TypeDArray::implicitConvTo to implement the deprecated feature, because it breaks phobos building. In std.process line 367: scope(exit) if (exists(filename)) remove(filename); // <---- Today, it calls std.file.remove in here. std.stdio.file line 413: void remove(in char[] name) But std.process also imports core.stdc.stdio through std.stdio. In there another 'remove' is defined. core.stdc.stdio line 453: int remove(in char* filename); // <---- After *fixing* the deprecated feature, the 'remove' call in std.process will match both 'remove's that defined in different modules, and it will raise an error according to overload set resolution rule. std\process.d(367): Error: std.file.remove at std\file.d(413) conflicts with core.stdc.stdio.remove at C:\Users\khara\dmd2\src\druntime\import\core\stdc\stdio.d(453) ---- So as a conclusion, we should just remove the deprecated "array to pointer conversion" feature, rather than fixing broken deprecated feature that already outdated. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 20 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9539 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull https://github.com/D-Programming-Language/dmd/pull/1679 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 21 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9539 Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/beee8e88c4bdff61087cd34353481e7c364690d3 fix Issue 9539 - Regression (2.061): Wrong-code on static array pointer -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 21 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9539 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.cc From the commit:the deprecated implicit conversion feature already being a cancer in D2 type system.Thank you Hara for fixing such things. Implicit type conversions are dangerous. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 21 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9539 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 21 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9539 13:19:34 PST --- Another person has ran into this recently. Shouldn't this be a good reason for an emergency release of a patched 2.062? It's really an awful bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 01 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9539 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |entheh cantab.net *** Issue 9518 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 10 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9539 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |phyphor0 gmail.com *** Issue 9916 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 11 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9539 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyfolee gmail.com 06:51:28 PDT --- *** Issue 10072 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 13 2013