https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85840
--- Comment #7 from Joshua Cogliati <jjcogliati-r1 at yahoo dot com> --- Created attachment 44185 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44185&action=edit Patch by checking against original buffer This is one possible patch for this problem, it just checks if the buffer is at a different address than the stack buffer. It does fix the problem in my test case.