Bug 10198 – CTFE: Wrong code for multi-dimensional block assignment

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-05-29T00:45:00Z
Last change time
2015-06-09T05:11:53Z
Keywords
CTFE, wrong-code
Assigned to
nobody
Creator
clugdbug

Comments

Comment #0 by clugdbug — 2013-05-29T00:45:35Z
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.
Comment #1 by bugzilla — 2013-07-05T01:59:05Z
Comment #2 by github-bugzilla — 2013-07-05T01:59:42Z
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
Comment #3 by bugzilla — 2013-07-05T02:00:03Z
Fixed for D2.