Bug 10243 – [CTFE] Wrong-code on passing dereferenced array pointer by ref

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-02T08:25:00Z
Last change time
2013-07-05T10:24:06Z
Keywords
CTFE, wrong-code
Assigned to
nobody
Creator
verylonglogin.reg

Comments

Comment #0 by verylonglogin.reg — 2013-06-02T08:25:35Z
--- void f(ref ubyte n) { n = 1; } void test() { ubyte[1] arr; f(*arr.ptr); assert(arr == [1]); } void main() { test(); static assert((test(), true)); // fails } ---
Comment #1 by github-bugzilla — 2013-06-18T00:37:40Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/0a752177003e3ea8813dea7279071c859b664779 Fix bug 10243 [CTFE] Wrong-code on passing dereferenced array pointer by ref Don't evaluate *&arr if it is reference.
Comment #2 by verylonglogin.reg — 2013-06-18T02:27:25Z
Original testcase still fails. Another reduced testcase: --- void f(ref ubyte n) { n = 1; } void g(ubyte* p) { f(p[0]); } void test() { ubyte[1] arr; //f(*arr.ptr); // now works g(arr.ptr); assert(arr == [1]); } void main() { test(); static assert((test(), true)); } ---
Comment #3 by clugdbug — 2013-07-04T01:14:14Z
The original test case in this bug report works for me now, and your comment "// now works" indicates that it is fixed for you as well? The code in comment 2 is a different bug. Although the effects look very similar, it is actually independent of the original one. The bug lies in a different part of the code. Generally, you should create a new bug report rather than reopening a bug, if the test case in the original bug report has been fixed.
Comment #4 by verylonglogin.reg — 2013-07-05T10:24:06Z
(In reply to comment #3) > The original test case in this bug report works for me now, and your comment > "// now works" indicates that it is fixed for you as well? > > The code in comment 2 is a different bug. Although the effects look very > similar, it is actually independent of the original one. The bug lies in a > different part of the code. > > Generally, you should create a new bug report rather than reopening a bug, if > the test case in the original bug report has been fixed. Sorry. Created Issue 10551.