diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 581c8d5b1d..b8d213916e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2007-08-14 Joel Brobecker + Michael Snyder + + * ada-lang.c (field_alignment): Guard against NULL. + 2007-08-14 Joel Brobecker * MAINTAINERS (Global Maintainers): Add self. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 0a27ba089e..4b1e2921fd 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -6116,9 +6116,17 @@ static unsigned int field_alignment (struct type *type, int f) { const char *name = TYPE_FIELD_NAME (type, f); - int len = (name == NULL) ? 0 : strlen (name); + int len; int align_offset; + /* The field name should never be null, unless the debugging information + is somehow malformed. In this case, we assume the field does not + require any alignment. */ + if (name == NULL) + return 1; + + len = strlen (name); + if (!isdigit (name[len - 1])) return 1;