* ada-lang.c (field_alignment): Guard against NULL.
authorJoel Brobecker <brobecker@gnat.com>
Tue, 14 Aug 2007 20:16:18 +0000 (20:16 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Tue, 14 Aug 2007 20:16:18 +0000 (20:16 +0000)
gdb/ChangeLog
gdb/ada-lang.c

index 581c8d5b1d82bce74610d33e6bd5dd83013df471..b8d213916eb90158d4cec6a29290c9ed8111f7c1 100644 (file)
@@ -1,3 +1,8 @@
+2007-08-14  Joel Brobecker  <brobecker@adacore.com>
+            Michael Snyder  <msnyder@access-company.com>
+
+       * ada-lang.c (field_alignment): Guard against NULL.
+
 2007-08-14  Joel Brobecker  <brobecker@adacore.com>
 
        * MAINTAINERS (Global Maintainers): Add self.
index 0a27ba089e57fb9be829efa2e51093aabaf43ee7..4b1e2921fd712069e0b9e2a9b0e428f6a2984e91 100644 (file)
@@ -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;
 
This page took 0.04051 seconds and 4 git commands to generate.