~ubuntu-branches/debian/sid/frama-c/sid

« back to all changes in this revision

Viewing changes to tests/misc/cast.c

  • Committer: Bazaar Package Importer
  • Author(s): Mehdi Dogguy
  • Date: 2009-06-03 08:19:25 UTC
  • Revision ID: james.westby@ubuntu.com-20090603081925-kihvxvt0wy3zc4ar
Tags: upstream-20081201.dfsg
ImportĀ upstreamĀ versionĀ 20081201.dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
char * X= "NULL";
 
2
void MC3_COM_ARRET_68040(int i , char *c, int j) {
 
3
  X = c;
 
4
}
 
5
 
 
6
static void MC3_ANALYSER_CPTRENDU(int n , char num_station , 
 
7
                                  short cptrendu )
 
8
{
 
9
 
 
10
  MC3_COM_ARRET_68040(160, (char *)"mc3_mdb_emi_act.c", 506);
 
11
 
 
12
}
 
13
 
 
14
 
 
15
int G,H,K,L,i,b;
 
16
unsigned int I;
 
17
signed char c,d,e;
 
18
unsigned char uc,ud;
 
19
long long ll,gg;
 
20
unsigned long long ull, ugg;
 
21
 
 
22
 
 
23
int any_int(void)
 
24
{ volatile int i = 0;
 
25
 int j;
 
26
 i =(int*)0 + i;
 
27
 return (i/4);};
 
28
 
 
29
void all_cast() {
 
30
  G=258;
 
31
  H=any_int();
 
32
 
 
33
 if (H>=258) {if (H<=268) {G = H;};};
 
34
  G = G&128?0xFFFFFF00|(G&255):(G&255);
 
35
  G = (signed char)G; // 2..12
 
36
 
 
37
  K=-10;
 
38
  if (H>=-10) {if (H<=20) {K = H;};};
 
39
  c = (signed char)(K); // -10..20
 
40
  uc = c ; // (signed char)(K); // 0..255
 
41
 
 
42
  K = c;
 
43
  I = (unsigned int)(signed char)(int)(-1);
 
44
  printf("%ud\n",I);
 
45
 
 
46
  L=-19;
 
47
  if (H>=-2000) {if (H<=-10) {L = H;}}
 
48
  d = L; // top
 
49
  ull=1;
 
50
  L=0;
 
51
  if (H>=-2000) {if (H<=1) {L = 2*H;}}
 
52
  e = L; // top
 
53
 
 
54
}
 
55
 
 
56
int main(void)
 
57
{
 
58
  int min = 130;
 
59
  int max = 135;
 
60
  int i;
 
61
  int G;
 
62
  for (i=min; i<=max; i++)
 
63
    {
 
64
      G = i&128?0xFFFFFF00|(i&255):(i&255);
 
65
      printf("cast:%d formule:%d\n",(int)(signed char) i,G);
 
66
      }
 
67
  printf("usc: %ud",(unsigned int)(signed char)(int)(-1));
 
68
}
 
69
 
 
70
 
 
71
void f() {
 
72
  G=258;
 
73
  if (H>=258) {if (H<=268) {G = H;};};
 
74
  I = (unsigned char)G; // = 2..12
 
75
 
 
76
}
 
77
 
 
78
//int main(){all_cast();}