This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Avoid SEGV in dwarf2out
- To: gcc-patches at egcs dot cygnus dot com
- Subject: [PATCH] Avoid SEGV in dwarf2out
- From: Jakub Jelinek <jakub at redhat dot com>
- Date: Sat, 4 Dec 1999 00:08:35 +0100
Hi!
Without this patch, gcc segfaults on noncompile/920824-1.c when compiled
with debugging both on 32bit and 64bit SPARC. IMHO gcc should not segfault
on any input.
Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | jakub@redhat.com | http://sunsite.mff.cuni.cz/~jj
Linux version 2.3.18 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________
1999-12-03 Jakub Jelinek <jakub@redhat.com>
* dwarf2out.c (field_byte_offset): Avoid segfault when
field_size_tree is NULL.
--- gcc/dwarf2out.c.jj Wed Dec 1 09:17:50 1999
+++ gcc/dwarf2out.c Fri Dec 3 23:46:20 1999
@@ -6704,7 +6704,7 @@ field_byte_offset (decl)
bitpos_int = (unsigned) TREE_INT_CST_LOW (bitpos_tree);
/* If we don't know the size of the field, pretend it's a full word. */
- if (TREE_CODE (field_size_tree) == INTEGER_CST)
+ if (field_size_tree && TREE_CODE (field_size_tree) == INTEGER_CST)
field_size_in_bits = (unsigned) TREE_INT_CST_LOW (field_size_tree);
else
field_size_in_bits = BITS_PER_WORD;