www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10243] New: [CTFE] Wrong-code on passing dereferenced array pointer by ref

reply d-bugmail puremagic.com writes:
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



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: -------
Jun 02 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10243




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: -------
Jun 18 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
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: -------
Jun 18 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
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                       |



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: -------
Jun 18 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10243




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: -------
Jul 04 2013
prev sibling parent d-bugmail puremagic.com writes:
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



21:24:06 MSD ---

 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: -------
Jul 05 2013