AnsweredAssumed Answered

One of my pointer values is getting optimized out. How do I prevent this?

Question asked by mccarthy.matt on Dec 23, 2014
Latest reply on Dec 24, 2014 by Danish Ali
I'm stepping through my code to see where a certain bug occurs with my display driver, and found that something strange is going on. An instance of the class gets initialized properly, but once I try to use a method of that class, the pointer value seems to have been changed somehow.

I appear to initialize correctly...

Display * volatile const sys_disp = new Display();
(gdb) p sys_disp
$1 = (Display * const volatile) 0x20002638

...but the value gets changed once I want to to use it.

(gdb) p sys_disp
$2 = (Display * const volatile) 0x0

Any ideas as to how I can keep the value the way it was? Why is this happening? I'll be happy to provide more debug output if necessary.