Runtime error about undefined behavior

Xi Xue wywywy3@outlook.com
Sat Dec 23 23:49:41 GMT 2023


tw.cpp:53:19: runtime error: member access within address 0x7fe7f52ff800 which does not point to an object of type 'CachedObj'
0x7fe7f52ff800: note: object has invalid vptr
 00 00 00 00  be be be be be be be be  be be be be be be be be  be be be be be be be be  be be be be
              ^~~~~~~~~~~~~~~~~~~~~~~
              invalid vptr
tw.cpp:41:39: runtime error: member access within address 0x7fe7f53ff7c0 which does not point to an object of type 'CachedObj'
0x7fe7f53ff7c0: note: object has invalid vptr
 00 00 00 00  00 00 00 00 00 00 00 00  a0 f7 3f f5 e7 7f 00 00  00 00 00 00 00 00 00 00  00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              invalid vptr
I am referring to a derived class. Access to the "next" member of the base class.Is this a runtime error?
---------------------------------------------
Compile command:
g++ -std=c++98 -O0 --ansi -fno-elide-constructors -Wall -fsanitize=address -fsanitize=undefined -g $name ; ASAN_OPTIONS=detect_leaks=1
./a.out

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tw.cpp
Type: text/x-c++src
Size: 4876 bytes
Desc: tw.cpp
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20231223/08fc2927/attachment.bin>


More information about the Gcc-help mailing list