summaryrefslogtreecommitdiff
path: root/test/regression/volatile1.c
blob: 10a7abeaa33010a4d1a44bb71db94feb0b3655d5 (plain)
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
#include <stdio.h>

volatile int v;

int f1(void) { return v; }

void f2(void) { v = 42; }

int f3(void) { return v / v + 1 + v; }

void f4(void) { v; }

volatile int t[2];

int f5(int x) { t[0] = x; return t[0]; }

int main()
{
  v = 123;
  printf("f1() = %d\n", f1());
  f2();
  printf("v = %d\n", v);
  printf("f3() = %d\n", f3());
  f4();
  printf("f5(2) = %d\n", f5(2));
  return 0;
}