Actions
Bug #3563
openFor flexible arrays CIL remembers the number of array elements after the first initialization and then when more elements are initialized it fails
Status:
New
Priority:
Normal
Assignee:
-
Category:
CIL
Target version:
-
Start date:
10/10/2012
Due date:
% Done:
0%
Estimated time:
Detected in build:
svn
Platform:
Published in build:
Description
During fixing #3378 issue it was noticed that CIL works incorrectly with flexible array initialization. For details refer to that issue.
Updated by Mikhail Mandrykin over 9 years ago
Current development version of CIL (bc1cb8e676e71c0adabe04da5d760d2c85f24268) behaves correctly at least on the following tests:
struct flex { int a; int b[]; }; struct flex fa = {1, {1}}; struct flex fb = {2, {2, 2}}; struct S { int field; int arr[]; }; struct S var1 = { .field = 0, .arr = { [0] = 1 } }; struct S var2 = { .field = 0, .arr = { 1, [3] = 2 } };
is translated into
struct flex fa = {1, {1}}; struct flex fb = {2, {2, 2}}; struct S var1 = {0, {1}}; struct S var2 = {0, {1, 0, 0, 2}};
Actions