Technically (at least on x86 and ARM), if b() allocates memory on the stack and returns a pointer to a(), as long as the pointer is dereferned immediately after the call the b(), the value should still be the same. It's not something you should count on (and purposely relying on it is a sin), but it won't kill your program.
It is an undefined behavior. It is very likely that something will go wrong, especially when optimizations are on. It is something you should never really on.
http://ideone.com/oIZXTY