http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50476
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> 2012-05-09 11:05:39 UTC --- I think it is only undefined behaviour to access the pointer after the life-time of y has finished, however, the following probably isn't, no? void g() { ... *x = 2; ... } void f() { ... x = &y; ... g(); ... x = NULL; } The C/C++ FE cannot distinguish between these two cases. Do you have a suggestion about how to implement this? I think it would require some kind of constant propagation to know that the final value of x is safe, but no existing contributor is interested in implementing such thing, so someone new has to step up and do the work.