Project

General

Profile

Actions

Bug #3435

open

Neither aspectator nor C back-end support variable arrays as field type

Added by Evgeny Novikov about 12 years ago. Updated almost 9 years ago.

Status:
Open
Priority:
High
Category:
C back-end
Start date:
09/12/2012
Due date:
% Done:

0%

Estimated time:
Detected in build:
svn
Platform:
Published in build:

Description

So, the given code (based on real driver drivers/usb/gadget/g_ffs.c):

void *malloc(int size);
int func(int a)
{
    struct
    {
      int x[a];
    } *d;
    d = malloc(sizeof *d);
}

lead to segmentation fault in CIF and to incorrect code printed by c-backend (if the last is used standalone):
int func(int a)
{
  ldv_1602;
  ldv_1602;
  ldv_1602 *d;
  d = ( ldv_1602 *) malloc ( ( int ) ( ( unsigned int ) ( a ) * 4U ) );
}

Actions

Also available in: Atom PDF