Bug 26106 - gdb/value.c:849: internal-error: bool value_contents_bits_eq(const value*, int, const value*, int, int): Assertion `offset2 + length <= TYPE_LENGTH (val2->enclosing_type) * TARGET_CHAR_BIT' failed.
Summary: gdb/value.c:849: internal-error: bool value_contents_bits_eq(const value*, in...
Status: RESOLVED DUPLICATE of bug 21356
Alias: None
Product: gdb
Classification: Unclassified
Component: pascal (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 10.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-10 13:21 UTC by Tom de Vries
Modified: 2024-07-17 18:21 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2020-06-10 13:21:15 UTC
[ This might be a duplicate of PR25102. ]

Consider the patch here ( https://src.fedoraproject.org/rpms/gdb/blob/master/f/gdb-archer-vla-tests.patch ).  It contains a test-case gdb.pascal/arrays.exp.

When running the test-case, we run into:
...
FAIL: gdb.pascal/arrays.exp: Print dynamic array of string (GDB internal error)
...

In more detail:
...
(gdb) print DynArrStr^M
$8 = {'X!ú÷ÿ'#127#0#0#24'"ú÷', 'ÿ'#127#0#0#152'"ú÷ÿ'#127#0, #24'#ú÷ÿ'#127#0#0#152'#ú÷', 'ÿ'#127#0#0#24'$ú÷ÿ'#127#0, #152'$ú÷ÿ'#127#0#0#24'%ú÷', 'ÿ'#127#0#0#152'%ú÷ÿ'#127#0, #24'&ú÷ÿ'#127#0#0#152'&ú÷', /data/gdb_versions/devel/src/gdb/value.c:849: internal-error: bool value_contents_bits_eq(const value*, int, const value*, int, int): Assertion `offset2 + length <= TYPE_LENGTH (val2->enclosing_type) * TARGET_CHAR_BIT' failed.^M
...

To reproduce on the command line:
...
$ gdb -batch outputs/gdb.pascal/arrays/arrays -ex "b 81" -ex r -ex "print DynArrStr"
...

Values causing assert to trigger:
...
(gdb) p offset2
$9 = 768
(gdb) p length
$10 = 96
(gdb) p offset2 + length
$11 = 864
(gdb) p val2->enclosing_type.length * 8
$12 = 832
...

Backtrace:
...
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff4f60b01 in __GI_abort () at abort.c:79
#2  0x00000000009a8e2a in dump_core () at src/gdb/utils.c:204
#3  0x00000000009a933c in internal_vproblem(internal_problem *, const char *, int, const char *, typedef __va_list_tag __va_list_tag *) (problem=0x1214080 <internal_error_problem>, 
    file=0xca1ff8 "src/gdb/value.c", line=849, 
    fmt=0xca1f8b "%s: Assertion `%s' failed.", ap=0x7fffffffcd68) at src/gdb/utils.c:414
#4  0x00000000009a9404 in internal_verror (file=0xca1ff8 "src/gdb/value.c", line=849, 
    fmt=0xca1f8b "%s: Assertion `%s' failed.", ap=0x7fffffffcd68) at src/gdb/utils.c:439
#5  0x0000000000b202c9 in internal_error (file=0xca1ff8 "src/gdb/value.c", line=849, 
    fmt=0xca1f8b "%s: Assertion `%s' failed.") at src/gdbsupport/errors.cc:55
#6  0x00000000009ca2c2 in value_contents_bits_eq (val1=0x1bb5540, offset1=672, val2=0x1bb5540, offset2=768, 
    length=96) at src/gdb/value.c:849
#7  0x00000000009ca4fb in value_contents_eq (val1=0x1bb5540, offset1=84, val2=0x1bb5540, offset2=96, length=12)
    at src/gdb/value.c:901
#8  0x00000000009c409c in value_print_array_elements (val=0x1bb5540, stream=0x1a75180, recurse=0, 
    options=0x7fffffffd1a0, i=7) at src/gdb/valprint.c:1933
#9  0x00000000007c9dc1 in pascal_value_print_inner (val=0x1bb5540, stream=0x1a75180, recurse=0, 
    options=0x7fffffffd1a0) at src/gdb/p-valprint.c:137
#10 0x00000000009c2214 in do_val_print (value=0x1bb5540, stream=0x1a75180, recurse=0, options=0x7fffffffd2b0, 
    language=0x123c5a0 <pascal_language_defn>) at src/gdb/valprint.c:982
#11 0x00000000009c25d0 in common_val_print (val=0x1bb5540, stream=0x1a75180, recurse=0, options=0x7fffffffd2b0, 
    language=0x123c5a0 <pascal_language_defn>) at src/gdb/valprint.c:1085
#12 0x00000000007caaa5 in pascal_value_print (val=0x1bb5540, stream=0x1a75180, options=0x7fffffffd430)
    at src/gdb/p-valprint.c:437
#13 0x00000000009c26de in value_print (val=0x1bb5540, stream=0x1a75180, options=0x7fffffffd430)
    at src/gdb/valprint.c:1123
#14 0x00000000007cf65a in print_formatted (val=0x1bb5540, size=0, options=0x7fffffffd430, stream=0x1a75180)
    at src/gdb/printcmd.c:320
#15 0x00000000007d1553 in print_value (val=0x1bb5540, opts=...)
    at src/gdb/printcmd.c:1188
#16 0x00000000007d16bb in print_command_1 (args=0x7fffffffe0df "DynArrStr", voidprint=1)
    at src/gdb/printcmd.c:1222
#17 0x00000000007d179c in print_command (exp=0x7fffffffe0df "DynArrStr", from_tty=0)
    at src/gdb/printcmd.c:1244
#18 0x0000000000502956 in do_const_cfunc (c=0x1a022f0, args=0x7fffffffe0df "DynArrStr", from_tty=0)
    at src/gdb/cli/cli-decode.c:95
#19 0x0000000000505c38 in cmd_func (cmd=0x1a022f0, args=0x7fffffffe0df "DynArrStr", from_tty=0)
    at src/gdb/cli/cli-decode.c:2113
#20 0x0000000000934f79 in execute_command (p=0x7fffffffe0e7 "r", from_tty=0)
    at src/gdb/top.c:655
#21 0x0000000000755dbb in catch_command_errors (command=0x934b09 <execute_command(char const*, int)>, 
    arg=0x7fffffffe0d9 "print DynArrStr", from_tty=0) at src/gdb/main.c:457
#22 0x000000000075719c in captured_main_1 (context=0x7fffffffd9d0)
    at src/gdb/main.c:1219
#23 0x0000000000757391 in captured_main (data=0x7fffffffd9d0) at src/gdb/main.c:1244
#24 0x00000000007573fc in gdb_main (args=0x7fffffffd9d0) at src/gdb/main.c:1269
#25 0x00000000004150b9 in main (argc=14, argv=0x7fffffffdad8) at src/gdb/gdb.c:32
...
Comment 1 Tom de Vries 2020-06-12 06:39:12 UTC
Since the problem is triggered by a test-case in the fedora patch set, is there a patch in there that is supposed to fix this?
Comment 2 lemo1234 2020-10-11 20:59:35 UTC
Please see the comment I just added to 25102.
Comment 3 Tom de Vries 2020-11-09 16:10:31 UTC
Note that apart from the internal error, it looks like we're also triggering PR26855.
Comment 4 Hannes Domani 2024-07-17 18:21:16 UTC
Dup.

*** This bug has been marked as a duplicate of bug 21356 ***