When I compile hello.c with: clang -g -O0 hello.c -o hello
, and disassemble it in GDB, I get the contents of hello.s
.
The line that confuses me is <main+34>
. It seems that when optimizations are off, clang saves unused return values on the stack. <main+34>
is saving the return value of printf
even though hello.c
doesn't do anything with it at all. I assume there's a reason for this. Why does it happen?