* src/mcs51/gen.c (gen51Code): show final register usage after fillGaps in asm with...
[fw/sdcc] / support / regression / tests / bug-971834.c
1 /* bug-971834.c
2
3    Life Range problem with
4    - uninitialized variable
5    - loop
6
7    LR problem hits all ports, but this test is mcs51 specific
8  */
9
10 #include <testfwk.h>
11
12 unsigned char ttt[] = {0xff, 1};
13 unsigned char b;
14
15 #if !defined(PORT_HOST)
16 #  pragma save
17 #  pragma disable_warning 84
18 #endif
19
20 unsigned char orsh (void)
21 {
22   unsigned char a, i;
23   for (i = 0; i < sizeof(ttt); i++)
24     a |= ttt[i];
25   return a;
26 }
27
28 unsigned char orsh1 (void)
29 {
30   unsigned char i, j;
31   unsigned char a;
32   for (j = 0; j < sizeof(ttt); j++)
33     {
34       for (i = 0; i < sizeof(ttt); i++)
35         {
36           a |= ttt[i];
37           b = a;
38         }
39     }
40   return b;
41 }
42 #if !defined(PORT_HOST)
43 #  pragma restore
44 #endif
45
46 void
47 testLR(void)
48 {
49   ASSERT(orsh()  == 0xff);
50   ASSERT(orsh1() == 0xff);
51 }