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