https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79992
Bug ID: 79992 Summary: accessing storage member of lambda via pointer with -no-pie causes the next function to overwrite the pointer's data Product: gcc Version: 6.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: yanai.eli11 at gmail dot com Target Milestone: --- See attached file for code, and compile it with `-no-pie`; I tried `-fno-strict-aliasing -fwrapv` and the problem still reproduces. Language: C++ Exact GCC version: 6.2.0 20161005 (Ubuntu 6.2.0-5ubuntu12) OS: Ubuntu Overall the problem is that when getting a pointer of member of lambda in certain flow, the pointer will point to the stack, and provoke other functions to overwrite it. I proved it by printing the variable twice without a gap, and it printed something else the second time.