File: pointer_loop.i

package info (click to toggle)
frama-c 20161101%2Bsilicon%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 42,324 kB
  • ctags: 35,695
  • sloc: ml: 200,142; ansic: 31,465; makefile: 2,334; sh: 1,643; lisp: 259; python: 85; asm: 26
file content (53 lines) | stat: -rw-r--r-- 871 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* run.config*
   COMMENT: this line preserves location...
 */
int base0=7;
int base1=1;
int base2=2;
int *base_p[2]={&base1,&base2};
int *Ctrl_p;
void main ()
{ short int i;
  int Elements = 2;

  for (i = 0; i < Elements; i++)
    {
      Ctrl_p = base_p[i];
      *Ctrl_p = 3+i;
      }
}


struct Ctrl;
typedef struct Slot {
  int Elements;
  struct Ctrl *const *Ctrl_p;
} Slot_t;
typedef struct Ctrl {
  const Slot_t *slot_p;
  int Status;
} Ctrl_t;

Ctrl_t Ctrl[2];
static Ctrl_t *const ACtrl[2] = {
  &Ctrl[0],
  &Ctrl[1]
};
const Slot_t Slot[2] = {
  { 2, &ACtrl[0]},
  { 0, (void *) 0}
};

void f(void)
{
  int i;
  enum counter j; // specific test for pointer_loop.c:42: error: storage size of 'j' isn't known
  i=0;
  (Slot[i].Ctrl_p[0])->Status = 0;
  (Slot[i].Ctrl_p[1])->Status = 0;
  for(j = 0; j < 2; j++) {
    (Slot[i].Ctrl_p[j])->Status = 1;

    }

}