Imported Upstream version 2.9.0
[debian/cc1111] / support / regression / tests / bug1839321.c
1 /*
2     bug 1839321
3 */
4
5 #include <testfwk.h>
6
7 xdata char Global = 2;
8
9 code struct Value {
10   char xdata * Name[2];
11 } Value_1 = {{&Global, 0}},
12   Value_2 = {{&Global, 0}};
13
14 char i = 1;
15
16 // note: this function expects its first parameter to be passed in
17 //        2 bytes on **stack** (not registers)
18 char bar(char xdata* code* ptr, ...)
19 {
20         return **ptr;
21 }
22
23 void foo (void) {
24 }
25
26
27 void
28 testBug(void)
29 {
30         ASSERT (bar(i ? Value_1.Name : Value_2.Name) == 2);
31 }