Thread overview
[Issue 10243] New: [CTFE] Wrong-code on passing dereferenced array pointer by ref
Jun 02, 2013
Denis Shelomovskij
Jun 18, 2013
yebblies
Jun 18, 2013
Denis Shelomovskij
Jul 04, 2013
Don
Jul 05, 2013
Denis Shelomovskij
June 02, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10243

           Summary: [CTFE] Wrong-code on passing dereferenced array
                    pointer by ref
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: CTFE, wrong-code
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: verylonglogin.reg@gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2013-06-02 19:25:35 MSD ---
---
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
}
---

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10243



--- Comment #1 from github-bugzilla@puremagic.com 2013-06-18 00:37:40 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10243


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies@gmail.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10243


Denis Shelomovskij <verylonglogin.reg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


--- Comment #2 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2013-06-18 13:27:25 MSD ---
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));
}
---

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 04, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10243



--- Comment #3 from Don <clugdbug@yahoo.com.au> 2013-07-04 01:14:14 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 05, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10243


Denis Shelomovskij <verylonglogin.reg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


--- Comment #4 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2013-07-05 21:24:06 MSD ---
(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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------