Maxim Kuvyrkov maxim.kuvyrkov@linaro.org writes:
[CC: Thiago, for GDB crash]
Thanks!
However, if I try to print "x", GDB crashes:
(gdb) p x $2 = ( _data = (0x6568, /build/gdb-aPmCGS/gdb-12.1/gdb/value.c:856: internal-error: value_contents_bits_eq: Assertion `offset1 + length <= TYPE_LENGTH (val1->enclosing_type) * TARGET_CHAR_BIT' failed. A problem internal to GDB has been detected, further debugging may prove unreliable.
I can reproduce this crash with GDB 12.1 from Ubuntu 22.04, but testing with current tip of trunk detects the corruption in the inferior:
Program received signal SIGSEGV, Segmentation fault. 0xf7da9070 in arena_for_chunk (ptr=0x26208) at arena.c:156 warning: 156 arena.c: No such file or directory (gdb) bt #0 0xf7da9070 in arena_for_chunk (ptr=0x26208) at arena.c:156 #1 arena_for_chunk (ptr=0x26208) at arena.c:160 #2 __GI___libc_free (mem=<optimized out>) at malloc.c:3390 #3 0x000125e8 in p () at /home/thiago.bauermann/src/gcc/gcc/testsuite/gfortran.dg/pr113363.f90:49 (gdb) frame 3 #3 0x000125e8 in p () at /home/thiago.bauermann/src/gcc/gcc/testsuite/gfortran.dg/pr113363.f90:49 49 deallocate (x, y) (gdb) p x $1 = ( _data = (<error reading variable: access outside bounds of object>, _vptr = 0x24090 <__vtab_CHARACTER_1_.7>, _len = 6 ) (gdb)
GDB 14.1 was the first version that didn't crash, but it shows garbage contents for x._data:
(gdb) p x $1 = ( _data = (0x6568, 0x65), _vptr = 0x24090 <__vtab_CHARACTER_1_.7>, _len = 6 )
GDB 15.1 will be the first version that shows the out of bounds error message.
-- Thiago