public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* gdb crashes due to a gcc bug (on AIX)
@ 2003-08-28  6:59 Michael Veksler
  0 siblings, 0 replies; only message in thread
From: Michael Veksler @ 2003-08-28  6:59 UTC (permalink / raw)
  To: gdb

gcc-3.2.1 emits wrong stubs debug information. This causes an assertion
failure in gdb on AIX. This failure happens during "break main".

The version that crashes is a weekly snapshot:
        GNU gdb 20030729

The unsorted debug information (nm -Cpf) is as follows:

_ZNKSt5ctypeIcE5tableEv:f1934=*1785 -       6648


This is the first occurrence of symbol 1785, and here we see the bug.
There is a "=k-8" missing. When according to rs6000_builtin_type,
"-8" stands for "unsigned int".

The line should have been:
_ZNKSt5ctypeIcE5tableEv:f1934=*1785=k-8 -       6648

This does not cause the crash yet. After several simple and harmless
references to 1785, there is:
locale:Tt1784=s4none:/21785=k-8:_ZNSt6locale4noneE;ctype:/21785:_ZNSt6 
......

This line should have been the first reference to 1785 because it defines
it to be k-8 (unsigned int). When GDB gets to this part of the debug info
it crashes. Here is the analysis of the crash:
stabsread.c:read_type(.....):
Reads 1785 and gets previously read debug information into
typeptr. This debug info is wrong, because it is not marked as
a builtin type (due to original missing "=k-8")
Enters the case for 'k' with typeptr wrongly marked as defined in
this translation unit:  TYPE_OBJFILE(*typeptr)->name != NULL
and wrongly read a new type for -8 into 'type' for which:
TYPE_OBJFILE(*typeptr)->name == NULL
make_cv_type is called with a bad typeptr and type combination
that crashes in its gdb_assert call.

I know that this is a gcc bug, but I also think that gdb should not crash
on such gcc bugs. This happens for gcc-3.2, for which development
had stopped, so it is not reasonable to look for a fix there.

It is difficult to generate this gcc bug on purpose (using a simple
example), although it happens all the time by accident :-(
I'll report this bug to GCC team once a simple example is found...

Also note that there is a PR for this bug that lacks this analysis. It is
GDB PR 1170.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-08-28  6:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-28  6:59 gdb crashes due to a gcc bug (on AIX) Michael Veksler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).