[gnu.gdb.bug] multiple inheritance bug in gdb 3.4.xxx

whitcomb@VIVALDI.BERKELEY.EDU (Gregg Whitcomb) (01/17/90)

machine: vax/ultrix
gdb 3.4
g++ 1.36.3 (gcc 1.36.92)

description:
printing class with two base types displays the wrong fields and values
for the second base class.  gdb reports an internal error during symbol
read.

------------
#include <stdio.h>

struct base1 {
    int b1;
    base1() {b1=0; };
};
struct base2 {
    int b2;
    base2() {b2=0; };
};
struct multipleDerived : base1, base2 { };

main()
{
    multipleDerived d;
    d.b1 = 1;
    d.b2 = 2;
    printf("num1=%d num2=%d\n", d.b1, d.b2);
}


------------
ic% g++ -g minheret.cc
ic% gdb a.out
GDB 3.4, Copyright (C) 1989 Free Software Foundation, Inc.
There is ABSOLUTELY NO WARRANTY for GDB; type "info warranty" for details.
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "info copying" to see the conditions.
Reading symbol data from /net/vivaldi/users/whitcomb/test/g++/a.out...done.
Type "help" for a list of commands.
(gdb) l
Reading in symbols for minheret.cc...Internal error: type offset non-zero in loo
kup_basetype_typedone.
5           base1() {b1=0; };
6       };
7       struct base2 {
8           int b2;
9           base2() {b2=0; };
10      };
11      struct multipleDerived : base1, base2 { };
12
13      main()
14      {
(gdb)
15          multipleDerived d;
16          d.b1 = 1;
17          d.b2 = 2;
18          printf("num1=%d num2=%d\n", d.b1, d.b2);
19      }
(gdb) break 18
Breakpoint 1 at 0x8e: file minheret.cc, line 18.
(gdb) run
Starting program: /net/vivaldi/users/whitcomb/test/g++/a.out

Bpt 1, main (1, 2147468132, 2147468140) (minheret.cc line 18)
18          printf("num1=%d num2=%d\n", d.b1, d.b2);
(gdb) p d
$1 = {
<base1> = {b1 = 1}
<base2> = {b1 = 0}
  members of multipleDerived: }
(gdb) n
num1=1 num2=2
0xa0    18          printf("num1=%d num2=%d\n", d.b1, d.b2);
(gdb)


---------------

-Gregg (whitcomb@vivaldi.berkeley.edu)