2 !!DESCRIPTION!! C-Manual Chapter 7.14: assignment operators
3 !!ORIGIN!! LCC 4.1 Testsuite
4 !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
10 int cbits; /* No. of bits per char */
12 int sbits; /* short */
14 int ubits; /* unsigned */
15 int fbits; /* float */
16 int dbits; /* double */
18 float fprec; /* Smallest number that can be */
19 float dprec; /* significantly added to 1. */
21 int flgs; /* Print return codes, by section */
22 int flgm; /* Announce machine dependencies */
23 int flgd; /* give explicit diagnostics */
24 int flgl; /* Report local return codes. */
25 int rrc; /* recent return code */
26 int crc; /* Cumulative return code */
27 char rfs[8]; /* Return from section */
31 int ubits; /* unsigned */
32 int fbits; /* float */
33 int dbits; /* double */
35 float fprec; /* Smallest number that can be */
36 float dprec; /* significantly added to 1. */
38 int flgs; /* Print return codes, by section */
39 int flgm; /* Announce machine dependencies */
40 int flgd; /* give explicit diagnostics */
41 int flgl; /* Report local return codes. */
42 int rrc; /* recent return code */
43 int crc; /* Cumulative return code */
44 char rfs[8]; /* Return from section */
46 #ifndef NO_OLD_FUNC_DECL
47 s714(pd0) /* 7.14 Assignment operators */
51 int s714(struct defs *pd0){
53 static char f[] = "Local error %d.\n";
54 static char s714er[] = "s714,er%d\n";
55 static char qs714[8] = "s714 ";
56 register int prlc, lrc;
76 while (*pt++ = *ps++);
78 /* This section tests the assignment operators.
80 It is an exhaustive test of all assignment statements
85 where vl and vr are variables from the set
86 {char,short,int,long,unsigned,float,double} and op is
87 one of the assignment operators. There are 395 such
90 The initial values for the variables have been chosen
91 so that both the initial values and the results will
92 "fit" in just about any implementation, and that the re-
93 sults will be such that they test for the proper form-
94 ation of composite operators, rather than checking for
95 the valid operation of those operators' components.
96 For example, in checking >>=, we want to verify that
97 a right shift and a move take place, rather than
98 whether or not there may be some peculiarities about
99 the right shift. Such tests have been made previously,
100 and to repeat them here would be to throw out a red
103 The table below lists the operators, assignment targets,
104 initial values for left and right operands, and the
105 expected values of the results.
107 = += -= *= /= %= >>= <<= &= ^= |=
108 char 2 7 3 10 2 1 1 20 8 6 14
109 short 2 7 3 10 2 1 1 20 8 6 14
110 int 2 7 3 10 2 1 1 20 8 6 14
111 long 2 7 3 10 2 1 1 20 8 6 14
112 unsigned 2 7 3 10 2 1 1 20 8 6 14
113 float 2 7 3 10 2.5 | |
114 double 2 7 3 10 2.5 | |
116 initial (5,2) | (5,2) | (12,10)
118 The following machine-generated program reflects the
119 tests described in the table.
126 if(prlc) printf(f,lrc);
132 if(prlc) printf(f,lrc);
138 if(prlc) printf(f,lrc);
144 if(prlc) printf(f,lrc);
150 if(prlc) printf(f,lrc);
156 if(prlc) printf(f,lrc);
162 if(prlc) printf(f,lrc);
168 if(prlc) printf(f,lrc);
174 if(prlc) printf(f,lrc);
180 if(prlc) printf(f,lrc);
186 if(prlc) printf(f,lrc);
192 if(prlc) printf(f,lrc);
198 if(prlc) printf(f,lrc);
204 if(prlc) printf(f,lrc);
210 if(prlc) printf(f,lrc);
216 if(prlc) printf(f,lrc);
222 if(prlc) printf(f,lrc);
228 if(prlc) printf(f,lrc);
234 if(prlc) printf(f,lrc);
240 if(prlc) printf(f,lrc);
246 if(prlc) printf(f,lrc);
252 if(prlc) printf(f,lrc);
258 if(prlc) printf(f,lrc);
264 if(prlc) printf(f,lrc);
270 if(prlc) printf(f,lrc);
276 if(prlc) printf(f,lrc);
282 if(prlc) printf(f,lrc);
288 if(prlc) printf(f,lrc);
294 if(prlc) printf(f,lrc);
300 if(prlc) printf(f,lrc);
306 if(prlc) printf(f,lrc);
312 if(prlc) printf(f,lrc);
318 if(prlc) printf(f,lrc);
324 if(prlc) printf(f,lrc);
330 if(prlc) printf(f,lrc);
336 if(prlc) printf(f,lrc);
342 if(prlc) printf(f,lrc);
348 if(prlc) printf(f,lrc);
354 if(prlc) printf(f,lrc);
360 if(prlc) printf(f,lrc);
366 if(prlc) printf(f,lrc);
372 if(prlc) printf(f,lrc);
378 if(prlc) printf(f,lrc);
384 if(prlc) printf(f,lrc);
390 if(prlc) printf(f,lrc);
396 if(prlc) printf(f,lrc);
402 if(prlc) printf(f,lrc);
408 if(prlc) printf(f,lrc);
414 if(prlc) printf(f,lrc);
420 if(prlc) printf(f,lrc);
426 if(prlc) printf(f,lrc);
432 if(prlc) printf(f,lrc);
438 if(prlc) printf(f,lrc);
444 if(prlc) printf(f,lrc);
450 if(prlc) printf(f,lrc);
456 if(prlc) printf(f,lrc);
462 if(prlc) printf(f,lrc);
468 if(prlc) printf(f,lrc);
474 if(prlc) printf(f,lrc);
480 if(prlc) printf(f,lrc);
486 if(prlc) printf(f,lrc);
492 if(prlc) printf(f,lrc);
498 if(prlc) printf(f,lrc);
504 if(prlc) printf(f,lrc);
510 if(prlc) printf(f,lrc);
516 if(prlc) printf(f,lrc);
522 if(prlc) printf(f,lrc);
528 if(prlc) printf(f,lrc);
534 if(prlc) printf(f,lrc);
540 if(prlc) printf(f,lrc);
546 if(prlc) printf(f,lrc);
552 if(prlc) printf(f,lrc);
558 if(prlc) printf(f,lrc);
564 if(prlc) printf(f,lrc);
570 if(prlc) printf(f,lrc);
576 if(prlc) printf(f,lrc);
582 if(prlc) printf(f,lrc);
588 if(prlc) printf(f,lrc);
594 if(prlc) printf(f,lrc);
600 if(prlc) printf(f,lrc);
606 if(prlc) printf(f,lrc);
612 if(prlc) printf(f,lrc);
618 if(prlc) printf(f,lrc);
624 if(prlc) printf(f,lrc);
630 if(prlc) printf(f,lrc);
636 if(prlc) printf(f,lrc);
642 if(prlc) printf(f,lrc);
648 if(prlc) printf(f,lrc);
654 if(prlc) printf(f,lrc);
660 if(prlc) printf(f,lrc);
666 if(prlc) printf(f,lrc);
672 if(prlc) printf(f,lrc);
678 if(prlc) printf(f,lrc);
684 if(prlc) printf(f,lrc);
690 if(prlc) printf(f,lrc);
696 if(prlc) printf(f,lrc);
702 if(prlc) printf(f,lrc);
708 if(prlc) printf(f,lrc);
714 if(prlc) printf(f,lrc);
720 if(prlc) printf(f,lrc);
726 if(prlc) printf(f,lrc);
732 if(prlc) printf(f,lrc);
738 if(prlc) printf(f,lrc);
744 if(prlc) printf(f,lrc);
750 if(prlc) printf(f,lrc);
756 if(prlc) printf(f,lrc);
762 if(prlc) printf(f,lrc);
768 if(prlc) printf(f,lrc);
774 if(prlc) printf(f,lrc);
780 if(prlc) printf(f,lrc);
786 if(prlc) printf(f,lrc);
792 if(prlc) printf(f,lrc);
798 if(prlc) printf(f,lrc);
804 if(prlc) printf(f,lrc);
810 if(prlc) printf(f,lrc);
816 if(prlc) printf(f,lrc);
822 if(prlc) printf(f,lrc);
828 if(prlc) printf(f,lrc);
834 if(prlc) printf(f,lrc);
840 if(prlc) printf(f,lrc);
846 if(prlc) printf(f,lrc);
852 if(prlc) printf(f,lrc);
858 if(prlc) printf(f,lrc);
864 if(prlc) printf(f,lrc);
870 if(prlc) printf(f,lrc);
876 if(prlc) printf(f,lrc);
882 if(prlc) printf(f,lrc);
888 if(prlc) printf(f,lrc);
894 if(prlc) printf(f,lrc);
900 if(prlc) printf(f,lrc);
906 if(prlc) printf(f,lrc);
912 if(prlc) printf(f,lrc);
918 if(prlc) printf(f,lrc);
924 if(prlc) printf(f,lrc);
930 if(prlc) printf(f,lrc);
936 if(prlc) printf(f,lrc);
942 if(prlc) printf(f,lrc);
948 if(prlc) printf(f,lrc);
954 if(prlc) printf(f,lrc);
960 if(prlc) printf(f,lrc);
966 if(prlc) printf(f,lrc);
972 if(prlc) printf(f,lrc);
978 if(prlc) printf(f,lrc);
984 if(prlc) printf(f,lrc);
990 if(prlc) printf(f,lrc);
996 if(prlc) printf(f,lrc);
1002 if(prlc) printf(f,lrc);
1008 if(prlc) printf(f,lrc);
1014 if(prlc) printf(f,lrc);
1020 if(prlc) printf(f,lrc);
1026 if(prlc) printf(f,lrc);
1032 if(prlc) printf(f,lrc);
1038 if(prlc) printf(f,lrc);
1044 if(prlc) printf(f,lrc);
1050 if(prlc) printf(f,lrc);
1056 if(prlc) printf(f,lrc);
1062 if(prlc) printf(f,lrc);
1068 if(prlc) printf(f,lrc);
1074 if(prlc) printf(f,lrc);
1080 if(prlc) printf(f,lrc);
1086 if(prlc) printf(f,lrc);
1092 if(prlc) printf(f,lrc);
1098 if(prlc) printf(f,lrc);
1104 if(prlc) printf(f,lrc);
1110 if(prlc) printf(f,lrc);
1116 if(prlc) printf(f,lrc);
1122 if(prlc) printf(f,lrc);
1128 if(prlc) printf(f,lrc);
1134 if(prlc) printf(f,lrc);
1140 if(prlc) printf(f,lrc);
1146 if(prlc) printf(f,lrc);
1152 if(prlc) printf(f,lrc);
1158 if(prlc) printf(f,lrc);
1164 if(prlc) printf(f,lrc);
1170 if(prlc) printf(f,lrc);
1176 if(prlc) printf(f,lrc);
1182 if(prlc) printf(f,lrc);
1188 if(prlc) printf(f,lrc);
1194 if(prlc) printf(f,lrc);
1200 if(prlc) printf(f,lrc);
1206 if(prlc) printf(f,lrc);
1212 if(prlc) printf(f,lrc);
1218 if(prlc) printf(f,lrc);
1224 if(prlc) printf(f,lrc);
1230 if(prlc) printf(f,lrc);
1236 if(prlc) printf(f,lrc);
1242 if(prlc) printf(f,lrc);
1248 if(prlc) printf(f,lrc);
1254 if(prlc) printf(f,lrc);
1260 if(prlc) printf(f,lrc);
1266 if(prlc) printf(f,lrc);
1272 if(prlc) printf(f,lrc);
1278 if(prlc) printf(f,lrc);
1284 if(prlc) printf(f,lrc);
1290 if(prlc) printf(f,lrc);
1296 if(prlc) printf(f,lrc);
1302 if(prlc) printf(f,lrc);
1308 if(prlc) printf(f,lrc);
1314 if(prlc) printf(f,lrc);
1320 if(prlc) printf(f,lrc);
1326 if(prlc) printf(f,lrc);
1332 if(prlc) printf(f,lrc);
1338 if(prlc) printf(f,lrc);
1344 if(prlc) printf(f,lrc);
1350 if(prlc) printf(f,lrc);
1356 if(prlc) printf(f,lrc);
1362 if(prlc) printf(f,lrc);
1368 if(prlc) printf(f,lrc);
1374 if(prlc) printf(f,lrc);
1380 if(prlc) printf(f,lrc);
1386 if(prlc) printf(f,lrc);
1392 if(prlc) printf(f,lrc);
1398 if(prlc) printf(f,lrc);
1404 if(prlc) printf(f,lrc);
1410 if(prlc) printf(f,lrc);
1416 if(prlc) printf(f,lrc);
1422 if(prlc) printf(f,lrc);
1428 if(prlc) printf(f,lrc);
1434 if(prlc) printf(f,lrc);
1440 if(prlc) printf(f,lrc);
1446 if(prlc) printf(f,lrc);
1452 if(prlc) printf(f,lrc);
1458 if(prlc) printf(f,lrc);
1464 if(prlc) printf(f,lrc);
1470 if(prlc) printf(f,lrc);
1476 if(prlc) printf(f,lrc);
1482 if(prlc) printf(f,lrc);
1488 if(prlc) printf(f,lrc);
1494 if(prlc) printf(f,lrc);
1500 if(prlc) printf(f,lrc);
1506 if(prlc) printf(f,lrc);
1514 if(prlc) printf(f,lrc);
1520 if(prlc) printf(f,lrc);
1526 if(prlc) printf(f,lrc);
1532 if(prlc) printf(f,lrc);
1538 if(prlc) printf(f,lrc);
1544 if(prlc) printf(f,lrc);
1550 if(prlc) printf(f,lrc);
1556 if(prlc) printf(f,lrc);
1562 if(prlc) printf(f,lrc);
1568 if(prlc) printf(f,lrc);
1574 if(prlc) printf(f,lrc);
1580 if(prlc) printf(f,lrc);
1586 if(prlc) printf(f,lrc);
1592 if(prlc) printf(f,lrc);
1599 if(prlc) printf(f,lrc);
1605 if(prlc) printf(f,lrc);
1611 if(prlc) printf(f,lrc);
1617 if(prlc) printf(f,lrc);
1623 if(prlc) printf(f,lrc);
1629 if(prlc) printf(f,lrc);
1635 if(prlc) printf(f,lrc);
1641 if(prlc) printf(f,lrc);
1647 if(prlc) printf(f,lrc);
1653 if(prlc) printf(f,lrc);
1659 if(prlc) printf(f,lrc);
1665 if(prlc) printf(f,lrc);
1671 if(prlc) printf(f,lrc);
1677 if(prlc) printf(f,lrc);
1684 if(prlc) printf(f,lrc);
1690 if(prlc) printf(f,lrc);
1696 if(prlc) printf(f,lrc);
1702 if(prlc) printf(f,lrc);
1708 if(prlc) printf(f,lrc);
1714 if(prlc) printf(f,lrc);
1720 if(prlc) printf(f,lrc);
1726 if(prlc) printf(f,lrc);
1732 if(prlc) printf(f,lrc);
1738 if(prlc) printf(f,lrc);
1743 if(pd0->flgd != 0) printf(s714er,1);
1748 /*********************************************************************************************
1749 the main loop that launches the sections
1750 *********************************************************************************************/
1752 #ifndef NO_TYPELESS_STRUCT_PTR
1753 int section(int j,struct* pd0){
1755 int section(int j,void* pd0){
1758 case 0: return s714(pd0);
1762 #define cq_sections 1
1765 C REFERENCE MANUAL (main)
1768 #ifndef NO_OLD_FUNC_DECL
1774 int main(int n,char **args) {
1778 static struct defs d0, *pd0;
1780 d0.flgs = 1; /* These flags dictate */
1781 d0.flgm = 1; /* the verbosity of */
1782 d0.flgd = 1; /* the program. */
1787 for (j=0; j<cq_sections; j++) {
1788 d0.rrc=section(j,pd0);
1789 d0.crc=d0.crc+d0.rrc;
1790 if(d0.flgs != 0) printf("Section %s returned %d.\n",d0.rfs,d0.rrc);
1793 if(d0.crc == 0) printf("\nNo errors detected.\n");
1794 else printf("\nFailed.\n");