Is the safe / portable use of the function parameter address guaranteed in a C89 / C99 compatible compiler?
As an example, AAPCS for 32-bit ARM uses the r0-r3 registers to pass parameters if the parameters of the function meet specific size and alignment requirements. I would suggest that using the address of a parameter that passed through the register would produce unexpected results, but I checked the test on the ARM compiler that I use and it seems to move these parameters to the stack if the code tries to reference the addresses of these parameters. Although it will look safe in my particular application, I wonder if it is guaranteed in an architecture (with an ANSI / ISO compatible compiler) that can directly use registers to pass parameters to the function.
Do the standards know this behavior?
source
share