Project

General

Profile

Actions

Bug #3563

open

For flexible arrays CIL remembers the number of array elements after the first initialization and then when more elements are initialized it fails

Added by Evgeny Novikov almost 12 years ago. Updated almost 10 years ago.

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.

Actions #1

Updated by Vadim Mutilin almost 10 years ago

  • Category set to CIL
Actions #2

Updated by Mikhail Mandrykin almost 10 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

Also available in: Atom PDF