[Issue 11416] Array and slice assignment causes garbage values

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 2 02:56:07 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11416


monarchdodra at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra at gmail.com
           Severity|normal                      |enhancement


--- Comment #1 from monarchdodra at gmail.com 2013-11-02 02:55:56 PDT ---
> x[] + y[]; //ok

First: 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: -------


More information about the Digitalmars-d-bugs mailing list