Bug 9248 – [2.061 beta] Concatenation of array literal and array produces corrupted result

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-01-01T08:03:00Z
Last change time
2013-01-02T12:23:34Z
Keywords
wrong-code
Assigned to
nobody
Creator
sludwig

Comments

Comment #0 by sludwig — 2013-01-01T08:03:52Z
The following code produces something similar to: in: 1 [2] out: [1, 1C11FE0] instead of: in: 1 [2] out: [1, 2] --- import std.stdio; void test2(void*[] arr){ writefln("out: %s", arr); } void test(void* a, void*[] arr){ writefln("in: %s %s", a, arr); test2([a] ~ arr); } void main(){ void*[] arr; arr ~= cast(void*)2; test(cast(void*)1, arr); } ---
Comment #1 by sludwig — 2013-01-01T08:14:47Z
Simplified test case: void main() { void*[] a = [cast(void*)1]; void*[] b = [cast(void*)2]; auto c = a ~ b; assert(c == [cast(void*)1, cast(void*)2]); } Corruption does not occur for integral element types.
Comment #2 by github-bugzilla — 2013-01-01T10:42:51Z
Commit pushed to staging at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/5b8d3b7e6537601f2f914d1109d85e8686f02098 fix Issue 9248 - [2.061 beta] Concatenation of array literal and array produces corrupted result
Comment #3 by github-bugzilla — 2013-01-02T12:23:34Z