int sub(void) { int *p; { int x = 123; p = &x; } // Although x is out-of-scope according to the language, // gcc/g++ allocates local variables by subroutine, not by block contour. // (Allocating by subroutine is faster and smaller.) // Therefore p still points somewhere into the current frame, // and memcheck does not complain when de-referencing p. // In order to elicit a complaint from memcheck, then the compiler // must allocate and de-allocate by block contour.
return *p; } ------------------------------------------------------------------------------ Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform _______________________________________________ Valgrind-users mailing list Valgrind-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-users