www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10198] New: CTFE: Wrong code for multi-dimensional block assignment

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10198

           Summary: CTFE: Wrong code for multi-dimensional block
                    assignment
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au



This code fails. Currently only val[0][] is initialized, the reset remains with
the default initializer.
---
struct MultiBlock {
    int val[3][4];
}

int multiblockTest()
{
   MultiBlock pp = MultiBlock(67);
   assert(pp.val[2][3] == 67);
   assert(pp.val[1][3] == 67);
  return 1;
}

static assert(multiblockTest());
---
Additionally, the wrong behaviour is coded into a test in the test suite, in
test42.d.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 29 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10198


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com



01:59:05 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2094

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 05 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10198




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/1962ce651883a323c73cfecbe01aa05c7bb16595
Fix issue 10198 CTFE struct Multidimensional block assignment

There are two bugs. (1) The code in todt.c ignored the possibility
that an initializer could be explicitly specified in the struct literal.
This is not the same as an initializer specified in the declaration of
the field.
This wrong behaviour was actually coded into a test in test42.d.
(2) The CTFE code didn't consider the multidimensional case.

https://github.com/D-Programming-Language/dmd/commit/b9b5c063d7f44b879d6fde74f400ff094ba85707


Fix issue 10198 CTFE struct Multidimensional block assignment

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 05 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10198




02:00:03 PDT ---
Fixed for D2.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 05 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10198


Andrei Alexandrescu <andrei erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrei erdani.com
         Resolution|                            |FIXED


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