[Bug c/71813] fprintf/printf function exception
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Jul 10 15:44:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71813
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu.org
--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> testArray goes out of scope and you access it outside of the scope.
> Undefined behavior.
GCC 6.1 even warns you about this with -Wall -Wextra -O2:
warning: function returns address of local variable [-Wreturn-local-addr]
See https://gcc.gnu.org/wiki/FAQ#misoptimization
More information about the Gcc-bugs
mailing list