Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / bug1273984.c.in
blobd371d61351e724bdf6c783eaa8a5e38de82531fa
1 /* An assignment inside a functioncall changed the type of the parameter.
2 See bug description 1273984 for details.
4 Bug detected and fixed by Guenther Jehle
6 sign: unsigned,
7 */
9 #include <testfwk.h>
11 void foo({sign} int val) {
12 val; //make the compiler happy
15 void fooInt({sign} int val) {
16 ASSERT(val==3);
19 void fooChar({sign} char val) {
20 ASSERT(val==6);
23 void
24 testAssignInFunctioncall(void)
26 volatile {sign} char charVal=3;
27 volatile {sign} int intVal=0x4040;
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);
35 intVal=6;
37 fooChar(charVal=intVal); // without patch, a int is put on the stack
38 foo(0xAAAA);
39 fooChar(charVal=intVal);