D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3895 - Appending a double[] to a float[] generates wrong code
Summary: Appending a double[] to a float[] generates wrong code
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 critical
Assignee: yebblies
URL:
Keywords: accepts-invalid, wrong-code
Depends on:
Blocks:
 
Reported: 2010-03-08 06:22 UTC by David Simcha
Modified: 2012-04-26 11:43 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description David Simcha 2010-03-08 06:22:04 UTC
import std.stdio;

void main() {
    double[] stuff = [1.,2.,3.,4.,5.];
    float[] otherStuff;
    otherStuff ~= stuff;
    writeln(otherStuff);
}


Output:

0 1.875 0 2 0 2.125 0 2.25 0 2.3125
Comment 1 Steven Schveighoffer 2010-03-08 06:34:29 UTC
When did this work?  I tested back to 2.036 and it still results in the same output (was testing in case it was something I did in my append patch).
Comment 2 David Simcha 2010-03-08 07:50:20 UTC
You're right.  What I can't figure out is how code that depended on this working seemed to work until now.  It might have something to do with changes to the Appender struct, since the code that I noticed this in actually used an Appender instead of appending using ~=.

Changing status from regression to major.
Comment 3 yebblies 2012-02-20 19:47:14 UTC
Wow this is awful.
Comment 4 github-bugzilla 2012-02-20 21:32:37 UTC
Commit pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/5aa1b47aedf85f9e67132e5fc7a1586d5f1b293a
Merge pull request #446 from yebblies/issue3895

This only works because of a bug in dmd, and it was probably supposed to...
Comment 5 github-bugzilla 2012-02-20 21:36:19 UTC
Commit pushed to master at https://github.com/D-Programming-Language/druntime

https://github.com/D-Programming-Language/druntime/commit/4610715c33531a9d11613ab78eec6af70f0f4851
Merge pull request #156 from yebblies/issue3895

This only works because of a bug in dmd, and it was probably supposed to...
Comment 6 github-bugzilla 2012-04-26 11:42:31 UTC
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/f20d0845f24361463acab77d314170b25b2825c4
fix Issue 3895 - Appending a double[] to a float[] generates wrong code