https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108094

--- Comment #2 from Li Shaohua <shaohua.li at inf dot ethz.ch> ---
(In reply to Martin Liška from comment #1)
> gcc pr108094.c -g -Wall -Werror -O2
> pr108094.c: In function ‘e’:
> pr108094.c:8:10: error: function returns address of local variable
> [-Werror=return-local-addr]
>     8 |   return c;
>       |          ^
> pr108094.c:4:7: note: declared here
>     4 |   int b[1]={0};
>       |       ^
> cc1: all warnings being treated as errors
> 
> The warning is quite obvious and should not be ignored.

So there is indeed a stack-use-after-return, but gcc's ASAN just does not
report it at -O2?

Reply via email to