2005-01-26 Daniel Berlin Fix PR debug/19345 * dwarf2out.c (add_abstract_origin_attribute): TYPE_STUB_DECL is not always going to give us a non-NULL result, so guard against that. Index: dwarf2out.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v retrieving revision 1.568 diff -u -p -r1.568 dwarf2out.c --- dwarf2out.c 20 Jan 2005 20:09:22 -0000 1.568 +++ dwarf2out.c 27 Jan 2005 03:17:40 -0000 @@ -10497,8 +10497,12 @@ add_abstract_origin_attribute (dw_die_re if (TYPE_P (fn)) fn = TYPE_STUB_DECL (fn); + + /* TYPE_STUB_DECL may have given us a NULL, which decl_function_context + won't like. */ + if (fn) + fn = decl_function_context (fn); - fn = decl_function_context (fn); if (fn) dwarf2out_abstract_function (fn); } Index: testsuite/gcc.dg/pr19345.c =================================================================== RCS file: testsuite/gcc.dg/pr19345.c diff -N testsuite/gcc.dg/pr19345.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gcc.dg/pr19345.c 27 Jan 2005 03:17:52 -0000 @@ -0,0 +1,13 @@ +/* We shouldn't crash trying to produce the inlined structure type die debug info. */ +/* { dg-do compile } */ +/* { dg-options "-O1 -g" } */ +inline void bar(char a[], unsigned int l) +{ + asm volatile ("" :: "m" ( *(struct {char x[l]; } *)a)); +} + +void foo(void) +{ + bar (0, 0); +} +