digitalmars.D.bugs - [Issue 11416] New: Array and slice assignment causes garbage values
- d-bugmail puremagic.com (25/25) Nov 01 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11416
- d-bugmail puremagic.com (21/22) Nov 02 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11416
- d-bugmail puremagic.com (6/6) Nov 02 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11416
http://d.puremagic.com/issues/show_bug.cgi?id=11416 Summary: Array and slice assignment causes garbage values Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: druntime AssignedTo: nobody puremagic.com ReportedBy: daniel350 bigpond.com void main() { float[3] x = [1,1,1]; float[] y = [4,4,4,4]; float[5] w = x[] + y[]; //ok writeln(w); // [5, 5, 5, 4, 5.60519e-45] } w should be [5, 5, 5, 4, float.init] Right? http://dpaste.dzfl.pl/fork/53b6d5b5 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 01 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11416 monarchdodra gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |monarchdodra gmail.com Severity|normal |enhancementx[] + y[]; //okFirst: This is already wrong, and should lead to an Error from druntime. Unfortunalty, since druntime is compiled in release mode, you don't trigger it: http://d.puremagic.com/issues/show_bug.cgi?id=8650 Second: "float[5] w = ..." well... ditto. If the array lengths don't match, it's wrong behavior. Conclusion: The program is wrong, but since druntime is in release, you don't get an error, so you see undefined behavior. It would have been nice if it had errored out, but didn't. You can always try it re-compiling druntime in non-release: you'll see it error. Changing this to ER: Should throw an error, or should be able to chose non-release druntime by default. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 02 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11416 The correctness of the language shouldn't be reliant on the runtime... -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 02 2013