Passing a null pointer as argument to formatting functions corresponding to
the %s specifier makes the libc choke on old versions of Solaris 10. The
attached patchlet fixes a recently added case and thus eliminates:
-FAIL: gcc.dg/debug/debug-7.c -gdwarf-2 -O (internal compiler error)
-FAIL: gcc.dg/debug/debug-7.c -gdwarf-2 -O (test for excess errors)
-FAIL: gcc.dg/debug/debug-7.c -gdwarf-2 -O3 (internal compiler error)
-FAIL: gcc.dg/debug/debug-7.c -gdwarf-2 -O3 (test for excess errors)
-FAIL: gcc.dg/debug/debug-7.c -gdwarf-2 -g3 -O (internal compiler error)
-FAIL: gcc.dg/debug/debug-7.c -gdwarf-2 -g3 -O (test for excess errors)
-FAIL: gcc.dg/debug/debug-7.c -gdwarf-2 -g3 -O3 (internal compiler error)
-FAIL: gcc.dg/debug/debug-7.c -gdwarf-2 -g3 -O3 (test for excess errors)
-FAIL: gcc.dg/debug/dwarf2/pr43237.c (internal compiler error)
-FAIL: gcc.dg/debug/dwarf2/pr43237.c (test for excess errors)
-UNRESOLVED: gcc.dg/debug/dwarf2/pr43237.c scan-assembler-not LLST[^\\\\r\\\
\n]*DW_AT_upper_bound
Tested on SPARC/Solaris and x86-64/Linux, applied on the mainline as obvious.
2018-01-10 Eric Botcazou <ebotca...@adacore.com>
* dwarf2out.c (dwarf2out_var_location): Do not pass NULL to fprintf.
--
Eric Botcazou
Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 256275)
+++ dwarf2out.c (working copy)
@@ -26584,11 +26584,16 @@ create_label:
if (var_loc_p && flag_debug_asm)
{
- const char *name = NULL, *sep = " => ", *patstr = NULL;
+ const char *name, *sep, *patstr;
if (decl && DECL_NAME (decl))
name = IDENTIFIER_POINTER (DECL_NAME (decl));
+ else
+ name = "";
if (NOTE_VAR_LOCATION_LOC (loc_note))
- patstr = str_pattern_slim (NOTE_VAR_LOCATION_LOC (loc_note));
+ {
+ sep = " => ";
+ patstr = str_pattern_slim (NOTE_VAR_LOCATION_LOC (loc_note));
+ }
else
{
sep = " ";