[Bug gdb/21356] New: value.c:828: internal-error: int value_contents_bits_eq(const value*, int, const value*, int, int): Assertion `offset1 + length <= TYPE_LENGTH (val1->enclosing_type) * TARGET_CHAR_BIT' failed

steve.merritt at intel dot com sourceware-bugzilla@sourceware.org
Wed Apr 5 19:21:00 GMT 2017


https://sourceware.org/bugzilla/show_bug.cgi?id=21356

            Bug ID: 21356
           Summary: value.c:828: internal-error: int
                    value_contents_bits_eq(const value*, int, const
                    value*, int, int): Assertion `offset1 + length <=
                    TYPE_LENGTH (val1->enclosing_type) * TARGET_CHAR_BIT'
                    failed
           Product: gdb
           Version: 7.12.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: steve.merritt at intel dot com
  Target Milestone: ---

gdb will assert when printing "container_object2" in the attached sample.

value.c:828: internal-error: int value_contents_bits_eq(const value*, int,
const value*, int, int): Assertion `offset1 + length <= TYPE_LENGTH
(val1->enclosing_type) * TARGET_CHAR_BIT' failed.


The use of a typedef in the declaration of one of the fields of the struct
container_struct2 is triggering the issue.

In the attached sample, there are two nearly identical structs,
container_struct1 and container_struct2.  The only difference between the two
is the use of a typedef in container_struct2 when declaring one of the fields. 
The field (_vla_struct_object2) is a variable length struct.

To reproduce:
   > gcc -g vls_assert.c
   > gdb a.out
   (gdb) b 49
   Breakpoint 1 at 0x40095a: file vls_assert.c, line 49.
   (gdb) r
   Breakpoint 1, vls_factory (n=5) at vls_assert.c:50
   50     return;
   (gdb) p container_object1
   $1 = {_container_member1 = 5, _vla_struct_object1 = {_some_member = 10, 
       _vla_field = {0, 2, 4, 6, 8}}}
   (gdb) p container_object2
   $2 = {_container_member2 = 15, _vla_struct_object2 = {_some_member = 0, 
       _vla_field = {
   value.c:828: internal-error: int value_contents_bits_eq(const value*, 
   int, const value*, int, int): Assertion `offset1 + length <= TYPE_LENGTH
   (val1->enclosing_type) * TARGET_CHAR_BIT' failed.

I reproduced the issue with gcc 4.8.3 and gcc 6.3.0 on EL7.0.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list