File: vla_goto2.i

package info (click to toggle)
frama-c 20201209%2Btitanium-4.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 55,200 kB
  • sloc: ml: 260,374; ansic: 51,885; sh: 3,578; makefile: 3,111; python: 1,029; perl: 897; lisp: 259; xml: 62; asm: 46
file content (26 lines) | stat: -rw-r--r-- 686 bytes parent folder | download | duplicates (4)
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
int case2(int arg) {
  {
    int a2[arg];
    if (arg)
      goto L; // goto L is valid.
  }

  {
    L: ; // although we are jumping in a block where a vla is defined,
         // the target of the jump dominates the declaration of the vla
         // so that it is outside of the scope of the vla and the
         // program is correctly defined

    int b2[arg];
  }
  return 0;
}

int case3(int arg) {
  int vla[arg];
  /* The return under the if is transformed into a goto to a unique return
     statement. The destructor for vla is inserted before this unique return
     statement. The goto must be changed to target this destructor. */
  if (arg >= 10) return 1;
  return 0;
}