This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
how --builtin--return--address() works??
- From: "RANJITH KUMAR KASUKURTHI" <ranjithk at cse dot iitb dot ac dot in>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 15 Sep 2008 12:55:12 +0530 (IST)
- Subject: how --builtin--return--address() works??
Hi all,
I know that __builtin_return_address() function returns the
return address of the current function when zero is passed
as an argument.
1) In which header file __builtin_return_address() function is defined?
2) Return address is stored on stack when a function is called. I think
__builtin_return_address()
is reading that value on stack and returning. Am I right?
If so
3) The location where that return address is stored on stack may vary
depending upon number of arguments passed to the function, or number of
local variables inside the function, or whether the function is returning
a value or not........
How __builtin_return_address() function knows where exactly the return
address is stored on stack????
Thanks in advance.
P.S. : My machine is pentium 4 processor and operating system is linux and
the compiler is gcc.