Fix DWARF2 testcase failures
Geoffrey Keating
gkeating@apple.com
Tue Apr 12 01:37:00 GMT 2005
Lots of dwarf2 testcases were failing, because current_function_decl
is NULL if no functions are compiled, yet output_line_info gets called
anyway (apparently to work around a HP 'nm' bug).
If there's no function, then last_text_section should be unchanged, so
cfun will never be dereferenced.
Bootstrapped and tested on i686-darwin.
--
- Geoffrey Keating <geoffk@apple.com>
===File ~/patches/gcc-dwarfhotcoldfix.patch=================
2005-04-11 Geoffrey Keating <geoffk@apple.com>
* dwarf2out.c (output_line_info): Don't try to dereference
a NULL current_function_decl.
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.582
diff -u -p -u -p -r1.582 dwarf2out.c
--- dwarf2out.c 9 Apr 2005 20:41:44 -0000 1.582
+++ dwarf2out.c 12 Apr 2005 01:29:09 -0000
@@ -7662,7 +7662,7 @@ output_line_info (void)
long line_delta;
unsigned long current_file;
unsigned long function;
- struct function *cfun = DECL_STRUCT_FUNCTION (current_function_decl);
+ struct function *cfun;
ASM_GENERATE_INTERNAL_LABEL (l1, LINE_NUMBER_BEGIN_LABEL, 0);
ASM_GENERATE_INTERNAL_LABEL (l2, LINE_NUMBER_END_LABEL, 0);
@@ -7732,6 +7732,11 @@ output_line_info (void)
a series of state machine operations. */
current_file = 1;
current_line = 1;
+
+ if (current_function_decl)
+ cfun = DECL_STRUCT_FUNCTION (current_function_decl);
+ else
+ cfun = NULL;
if (last_text_section == in_unlikely_executed_text
|| (last_text_section == in_named
&& last_text_section_name == cfun->unlikely_text_section_name))
============================================================
More information about the Gcc-patches
mailing list