Thread overview
[Issue 10198] New: CTFE: Wrong code for multi-dimensional block assignment
May 29, 2013
Don
Jul 05, 2013
Walter Bright
Jul 05, 2013
Walter Bright
May 29, 2013
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


--- Comment #0 from Don <clugdbug@yahoo.com.au> 2013-05-29 00:45:35 PDT ---
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: -------
July 05, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10198


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> 2013-07-05 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: -------
July 05, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10198



--- Comment #2 from github-bugzilla@puremagic.com 2013-07-05 01:59:42 PDT ---
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 Merge pull request #2094 from donc/ctfe10198multiblock

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: -------
July 05, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10198



--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2013-07-05 02:00:03 PDT ---
Fixed for D2.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 10, 2013
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: -------