Answer the question
In order to leave comments, you need to log in
How to read function arguments on the stack / force gcc to store function arguments on the stack?
Tried __attribute__(__cdecl__) and CMAKE_C_FLAGS " -O0 " didn't help.
void foo (char arg1, int arg2, ... );
At the call point foo('a', 5, 'b', 39, 'c', 46, 'd', 55)
definition
void __attribute__((__cdecl__)) SumIntDouble(char type_code, int arg, ...) {
printf("VIEW: %c\n", *(&type_code + 0));
printf("VIEW: %c\n", *(&type_code + 1));
printf("VIEW: %c\n", *(&type_code + 2));
printf("VIEW: %c\n", *(&type_code + 3));
printf("VIEW: %c\n", *(&type_code + 4));
printf("VIEW: %c\n", *(&type_code + 5));
printf("VIEW: %c\n", *(&type_code + 6));
Answer the question
In order to leave comments, you need to log in
https://godbolt.org/z/ARYhis
Looking into the function prologue, it makes a local copy of our a. And the desired stack location is 36 bytes higher than what you're looking for.
Of course, everything is under x86. The call under x64 implies registers.
UPD. But Intel does not make local copies and everything is in place.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question