File: shift.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 (59 lines) | stat: -rw-r--r-- 1,042 bytes parent folder | download
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
54
55
56
57
58
59
/* run.config*
   STDOPT: #"-val -warn-unsigned-overflow"
   STDOPT: #"-no-val-left-shift-negative-alarms"
*/

int a,b,d,e,f,g,h;
unsigned int ua,ub,uc,ud,ue,uf;

void printf(const char* c,...);

char t[10];
volatile v;

int main(int c, int z, int zz) {
  a=5024;
  d = 255;
  f= -255;
  if ((c<=3) && (c>=0)) {
    c = 2*c-1;
    if (v) {
      a = 157 << c;
      /*@ assert c >= 0; */ /* Reduction by the alarm on RHS */ }
    if (v) {
      d=1975;
      d = d >> c;
      /*@ assert c >= 0; */ /* Reduction by the alarm on RHS */ }
    if (v) {
      f= -1975;
      f = f >> c; }
    if (v) {
      c = c << 3;
      /*@ assert c >= 0; */ /* Reduction by the alarm on LHS */ }
    }

  if (z & 1) z=1<<32;
  if (zz) zz=1>>5555;

  if (z & 16) {
    b = 66;
    b = b << b;
    };


  ua = 5607;
  ua >>= 2 ;
  ub = (unsigned int)(-3000);
  ub >>= 2;
  printf("ua:%u\nub:%u\n",ua,ub);

  if (z & 32)
  {
    int r = (unsigned long)t << 8;
    r += (long)t << 8;
  }

  unsigned int shl = 2U << 31; // "Unsigned overflow."

  return b;
}