Hi,
For same condition, post-increment operator making wrong result.
For example:
test = 1; foo( test++);
must pass to function foo the value equal 1, but it will be 2.
This error will be if:
1. parameter type is short
2. must be switch on "Optimizes for size" or "Optimizes for speed"
3. calling conv is cdecl or stdcall
The example generated error:
CCFLAGS= -Tx86-coff -Ot -Gd -Ze -Zx
#include <stdio.h>
void testPar(short sp1, short sp2, int ip1, int ip2);
int main()
{
short sp1 = 1;
short sp2 = 1;
int ip1 = 1;
int ip2 = 1;
printf("\tTest PellesC\n");
testPar(++sp1, sp2++, ++ip1, ip2++);
getchar();
return 0;
}
void testPar(short sp1, short sp2, int ip1, int ip2)
{
printf("sp1=%u \tsp2=%u \n",sp1,sp2);
printf("ip1=%u \tip2=%u \n",ip1,ip2);
return;
}