how --builtin--return--address() works??

RANJITH KUMAR KASUKURTHI ranjithk@cse.iitb.ac.in
Mon Sep 15 07:25:00 GMT 2008


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.



More information about the Gcc-help mailing list