1 /*  An assignment inside a functioncall changed the type of the parameter.
2     See bug description 1273984 for details.
3 
4     Bug detected and fixed by Guenther Jehle
5 
6     sign: unsigned,
7  */
8 
9 #include <testfwk.h>
10 
11 void foo({sign} int val) {
12   val; //make the compiler happy
13 }
14 
15 void fooInt({sign} int val) {
16   ASSERT(val==3);
17 }
18 
19 void fooChar({sign} char val) {
20   ASSERT(val==6);
21 }
22 
23 void
testAssignInFunctioncall(void)24 testAssignInFunctioncall(void)
25 {
26   volatile {sign} char charVal=3;
27   volatile {sign} int intVal=0x4040;
28 
29   fooInt(intVal=charVal); // should cast charVal to int for function call.
30                           // without patch #1645121, a char is put on the stack
31                           // (or hold in registers)
32   foo(0xAAAA);
33   fooInt(intVal=charVal);
34 
35   intVal=6;
36 
37   fooChar(charVal=intVal); // without patch, a int is put on the stack
38   foo(0xAAAA);
39   fooChar(charVal=intVal);
40 
41 }
42 
43 
44