File: addsub.c

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 (31 lines) | stat: -rw-r--r-- 565 bytes parent folder | download | duplicates (3)
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
/* run.config
   OPT: -rte -warn-signed-overflow -print -machdep x86_32
*/

int main() {
  
  int x=0,y=0,z=0;

  z = (int) 0x7fffffff + (int) 0x7fffffff; /* false */
  z =  - 0x7fffffff - 0x7fffffff; /* false */
  z = (- (int) (-0x7fffffff -1)) - 1; /* false */

  z = (int) 0x7fffffff + 0; /* true */
  z = - (int) 0x7fffffff - 1; /* true */

  z = x + y;

  z = - (int) 0x7ffffffc - y;
  z = - x - (int) 0x7ffffffc;

  z = (int) 0x7ffffffc + y;
  z = x + (int) 0x7ffffffc;

  z = y + (-2);
  z = y - (-2);
  z = -1 - y;
  z = -2 - y;
  z = 0 - y;

  return 0;
}