File: divmod_typedef.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 (45 lines) | stat: -rw-r--r-- 859 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* run.config
   OPT: -rte -warn-signed-overflow -warn-signed-downcast -print -machdep x86_32 -journal-disable
*/

#include "share/libc/limits.h"

typedef int tint;
typedef unsigned int tuint;

int main() {
  
  tint x=0,y=0,z=0;
  tuint ux=0,uy=0,uz=0;

  z = INT_MIN / -1 ;
  z = INT_MIN % -1 ;

  uz = 1 / 0;
  uz = 1 / (0xffffffff + 1);

  ux = 0x80000000;
  uy = 0xffffffff;

  uz = ((tint) ux) / ((tint) uy); // floating point exception
  uz = ux / uy; // correct if uy != 0
  uz = 0x80000000 / (0xffffffff + 1);
  uz = ((tint) (-0x7fffffff -1)) / ((tint) -1);
  uz = ((tint) (-0x7fffffff -1)) /  0xffffffff;
  uz =  0x80000000 / (tint) -1;
  uz = (tint) (0x80000000 / 0xffffffff);

  z = 1 / (x + y) ;

  z = x / -1;
  
  z = (- 0x7ffffff - 1) / y;

  z = (-2147483648L) / (-1L) ;

  z = 0x80000000 / -1;

  z = 0x80000000 / 0xffffffff;

  return 0;
}