scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

0137-int-cast.c (2947B)


      1 /*
      2 name: TEST013
      3 description: Basic test of integer types and integer conversions
      4 comments: This test depends of the configuration in the type system.
      5           With the current configuration char is equal to unsigned char,
      6           short is equal to int, and unsigned short is equal to unsigned.
      7 error:
      8 output:
      9 G1	I	"a
     10 G2	N	"b
     11 G3	K	"c
     12 G4	C	"d
     13 G5	K	"e
     14 G6	W	"f
     15 G7	Z	"g
     16 G8	Q	"h
     17 G9	O	"i
     18 G10	I	"j
     19 G11	N	"k
     20 G13	I	F	"main
     21 {
     22 \
     23 	G1	G2	gI	:I
     24 	G1	G3	gI	:I
     25 	G1	G4	gI	:I
     26 	G1	G5	gI	:I
     27 	G1	G6	gI	:I
     28 	G1	G7	gI	:I
     29 	G1	G8	gI	:I
     30 	G1	G9	gI	:I
     31 	G1	G10	:I
     32 	G1	G11	gI	:I
     33 	G2	G1	gN	:N
     34 	G2	G3	gN	:N
     35 	G2	G4	gN	:N
     36 	G2	G5	gN	:N
     37 	G2	G6	gN	:N
     38 	G2	G7	gN	:N
     39 	G2	G8	gN	:N
     40 	G2	G9	gN	:N
     41 	G2	G10	gN	:N
     42 	G2	G11	:N
     43 	G3	G1	gK	:K
     44 	G3	G2	gK	:K
     45 	G3	G4	gK	:K
     46 	G3	G5	:K
     47 	G3	G6	gK	:K
     48 	G3	G7	gK	:K
     49 	G3	G8	gK	:K
     50 	G3	G9	gK	:K
     51 	G3	G10	gK	:K
     52 	G3	G11	gK	:K
     53 	G4	G1	gC	:C
     54 	G4	G2	gC	:C
     55 	G4	G3	gC	:C
     56 	G4	G5	gC	:C
     57 	G4	G6	gC	:C
     58 	G4	G7	gC	:C
     59 	G4	G8	gC	:C
     60 	G4	G9	gC	:C
     61 	G4	G10	gC	:C
     62 	G4	G11	gC	:C
     63 	G5	G1	gK	:K
     64 	G5	G2	gK	:K
     65 	G5	G3	:K
     66 	G5	G4	gK	:K
     67 	G5	G6	gK	:K
     68 	G5	G7	gK	:K
     69 	G5	G8	gK	:K
     70 	G5	G9	gK	:K
     71 	G5	G10	gK	:K
     72 	G5	G11	gK	:K
     73 	G6	G1	gW	:W
     74 	G6	G2	gW	:W
     75 	G6	G3	gW	:W
     76 	G6	G4	gW	:W
     77 	G6	G5	gW	:W
     78 	G6	G7	gW	:W
     79 	G6	G8	gW	:W
     80 	G6	G9	gW	:W
     81 	G6	G10	gW	:W
     82 	G6	G11	gW	:W
     83 	G7	G1	gZ	:Z
     84 	G7	G2	gZ	:Z
     85 	G7	G3	gZ	:Z
     86 	G7	G4	gZ	:Z
     87 	G7	G5	gZ	:Z
     88 	G7	G6	gZ	:Z
     89 	G7	G8	gZ	:Z
     90 	G7	G9	gZ	:Z
     91 	G7	G10	gZ	:Z
     92 	G7	G11	gZ	:Z
     93 	G8	G1	gQ	:Q
     94 	G8	G2	gQ	:Q
     95 	G8	G3	gQ	:Q
     96 	G8	G4	gQ	:Q
     97 	G8	G5	gQ	:Q
     98 	G8	G6	gQ	:Q
     99 	G8	G7	gQ	:Q
    100 	G8	G9	gQ	:Q
    101 	G8	G10	gQ	:Q
    102 	G8	G11	gQ	:Q
    103 	G9	G1	gO	:O
    104 	G9	G2	gO	:O
    105 	G9	G3	gO	:O
    106 	G9	G4	gO	:O
    107 	G9	G5	gO	:O
    108 	G9	G6	gO	:O
    109 	G9	G7	gO	:O
    110 	G9	G8	gO	:O
    111 	G9	G10	gO	:O
    112 	G9	G11	gO	:O
    113 	G10	G1	:I
    114 	G10	G2	gI	:I
    115 	G10	G3	gI	:I
    116 	G10	G4	gI	:I
    117 	G10	G5	gI	:I
    118 	G10	G6	gI	:I
    119 	G10	G7	gI	:I
    120 	G10	G8	gI	:I
    121 	G10	G9	gI	:I
    122 	G10	G11	gI	:I
    123 	G11	G1	gN	:N
    124 	G11	G2	:N
    125 	G11	G3	gN	:N
    126 	G11	G4	gN	:N
    127 	G11	G5	gN	:N
    128 	G11	G6	gN	:N
    129 	G11	G7	gN	:N
    130 	G11	G8	gN	:N
    131 	G11	G10	gN	:N
    132 	G11	G9	gN	:N
    133 }
    134 */
    135 
    136 int a;
    137 unsigned b;
    138 char c;
    139 signed char d;
    140 unsigned char e;
    141 long f;
    142 unsigned long g;
    143 long long h;
    144 unsigned long long i;
    145 short j;
    146 unsigned short k;
    147 
    148 int
    149 main(void)
    150 {
    151 	a = b;
    152 	a = c;
    153 	a = d;
    154 	a = e;
    155 	a = f;
    156 	a = g;
    157 	a = h;
    158 	a = i;
    159 	a = j;
    160 	a = k;
    161 
    162 	b = a;
    163 	b = c;
    164 	b = d;
    165 	b = e;
    166 	b = f;
    167 	b = g;
    168 	b = h;
    169 	b = i;
    170 	b = j;
    171 	b = k;
    172 
    173 	c = a;
    174 	c = b;
    175 	c = d;
    176 	c = e;
    177 	c = f;
    178 	c = g;
    179 	c = h;
    180 	c = i;
    181 	c = j;
    182 	c = k;
    183 
    184 	d = a;
    185 	d = b;
    186 	d = c;
    187 	d = e;
    188 	d = f;
    189 	d = g;
    190 	d = h;
    191 	d = i;
    192 	d = j;
    193 	d = k;
    194 
    195 	e = a;
    196 	e = b;
    197 	e = c;
    198 	e = d;
    199 	e = f;
    200 	e = g;
    201 	e = h;
    202 	e = i;
    203 	e = j;
    204 	e = k;
    205 
    206 	f = a;
    207 	f = b;
    208 	f = c;
    209 	f = d;
    210 	f = e;
    211 	f = g;
    212 	f = h;
    213 	f = i;
    214 	f = j;
    215 	f = k;
    216 
    217 	g = a;
    218 	g = b;
    219 	g = c;
    220 	g = d;
    221 	g = e;
    222 	g = f;
    223 	g = h;
    224 	g = i;
    225 	g = j;
    226 	g = k;
    227 
    228 	h = a;
    229 	h = b;
    230 	h = c;
    231 	h = d;
    232 	h = e;
    233 	h = f;
    234 	h = g;
    235 	h = i;
    236 	h = j;
    237 	h = k;
    238 
    239 	i = a;
    240 	i = b;
    241 	i = c;
    242 	i = d;
    243 	i = e;
    244 	i = f;
    245 	i = g;
    246 	i = h;
    247 	i = j;
    248 	i = k;
    249 
    250 	j = a;
    251 	j = b;
    252 	j = c;
    253 	j = d;
    254 	j = e;
    255 	j = f;
    256 	j = g;
    257 	j = h;
    258 	j = i;
    259 	j = k;
    260 
    261 	k = a;
    262 	k = b;
    263 	k = c;
    264 	k = d;
    265 	k = e;
    266 	k = f;
    267 	k = g;
    268 	k = h;
    269 	k = j;
    270 	k = i;
    271 
    272 	return 0;
    273 }