Warn if making external references to local stack memory?

2012-04-08 Thread sa...@hederstierna.com
Hi GCC does warn if returning a pointer to a local variable (stack memory). But there are alot of more cases where GCC could possibly warn, eg. when references are made to local variables or stack memory. See this attached example code. GCC warns for first case, but not the others. I think all ca

Re: Warn if making external references to local stack memory?

2012-04-09 Thread Ian Lance Taylor
"sa...@hederstierna.com" writes: > GCC does warn if returning a pointer to a local variable (stack memory). > But there are alot of more cases where GCC could possibly warn, > eg. when references are made to local variables or stack memory. > > See this attached example code. > GCC warns for firs

Re: Warn if making external references to local stack memory?

2012-04-10 Thread Fredrik Hederstierna
family/c-common.c. I haven't really thought about what is required > here, though. I've added the following enhancement request to bugzilla http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52923 "BugĀ 52923 - Warn if making external references to local stack memory" Thanks & Best Regards Fredrik