[Bug c/59863] const array in function is placed on stack

joseph at codesourcery dot com gcc-bugzilla@gcc.gnu.org
Fri Jan 17 23:26:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59863

--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
On Fri, 17 Jan 2014, sam at gcc dot gnu.org wrote:

> Is there anything in the C standard preventing a const array declared in a
> function from being put in .rodata or are those missed optimizations?

If the object address can escape and the function can be called 
recursively, this would violate the requirement for distinct objects to 
have distinct addresses.  (See discussion on comp.std.c, "uniqueness of 
automatic objects", Nov 2008; I'm not sure if there was a corresponding 
GCC bug report / fix.)



More information about the Gcc-bugs mailing list