Parameters not passing correctly

Started by Basic Poke June 30, 2008
I am writing a program for the PIC18F66J50, using MPLAB IDE v8.14
(also happened with 8.10). Suddenly I noticed one of my functions
was not working correctly, and discovered that inside the function
the parameters that were passed in do not have the values that was
used in the function call. I made a test function (see below) and
the same thing happens.

void main()

void ServiceDebugPrint()
Test( 1, 2.0 ); //breakpoint here

void Test( unsigned char a, float b )
unsigned char c = 0;
unsigned char d = 0;
unsigned char e = 0;
c = 1;
d = 2;
e = 3;
c = d;
d = e;
e = c;

When I step through the function, the watch window shows the
following values:
a = 0x00
b = 2.298970e-041
These values are the same every time I run the program.

If I reverse the order of the arguments (change to "unsigned char a,
float b") the values become:
a = 0x16
b = 8.968310e-044

It is not a matter of the name "Test", if I use a different name the
same thing happens.

IMPORTANT CLUE: If I call Test() as the first line of main(), the
parameters are passed correctly.

It's like I'm running out of RAM or stack space. Any ideas what's
going on here?