[PATCH] Fix PR43080

Richard Guenther rguenther@suse.de
Mon Apr 26 09:33:00 GMT 2010


This patch makes us deal gracefully with NULL DECL_NAME which happens
for anonymous unions.  The result is the same as what happens for
non-LTO debuginfo.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2010-04-26  Richard Guenther  <rguenther@suse.de>

	PR lto/43080
	* gimple.c (gimple_decl_printable_name): Deal gracefully
	with a NULL DECL_NAME.

	* g++.dg/lto/20100423-3_0.C: New testcase.

Index: gcc/gimple.c
===================================================================
*** gcc/gimple.c	(revision 158670)
--- gcc/gimple.c	(working copy)
*************** gimple_ior_addresses_taken (bitmap addre
*** 4579,4585 ****
  const char *
  gimple_decl_printable_name (tree decl, int verbosity)
  {
!   gcc_assert (decl && DECL_NAME (decl));
  
    if (DECL_ASSEMBLER_NAME_SET_P (decl))
      {
--- 4579,4586 ----
  const char *
  gimple_decl_printable_name (tree decl, int verbosity)
  {
!   if (!DECL_NAME (decl))
!     return NULL;
  
    if (DECL_ASSEMBLER_NAME_SET_P (decl))
      {
Index: gcc/testsuite/g++.dg/lto/20100423-3_0.C
===================================================================
*** gcc/testsuite/g++.dg/lto/20100423-3_0.C	(revision 0)
--- gcc/testsuite/g++.dg/lto/20100423-3_0.C	(revision 0)
***************
*** 0 ****
--- 1,14 ----
+ // { dg-lto-do assemble }
+ // { dg-lto-options {{-flto -g}} }
+ 
+ inline int foo()
+ {
+   static union { int i; };
+   return i;
+ }
+ 
+ void bar()
+ {
+   foo();
+ }
+ 



More information about the Gcc-patches mailing list