This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[lto][patch] Maybe fix PR3779


I think this fixes PR3779, but I have only tried a X86 -> PPC compiler instead
of a native build.

The problem for PPC is that flag_dwarf2_cfi_asm was false when calling
dwarf2out_do_cfi_asm. This caused the function to return false immediately and
miss the test for current_function_decl being null.

The patch just moves the test for current_function_decl up in the function body.

2009-03-26  Rafael Avila de Espindola  <espindola@google.com>

	* dwarf2out.c (dwarf2out_do_cfi_asm): Make the check for
	current_function_decl being null the first thing in the function.

Cheers,
-- 
Rafael Avila de Espindola

Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 28d9abe..7448462 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -139,6 +139,15 @@ int
 dwarf2out_do_cfi_asm (void)
 {
   int enc;
+  tree personality_decl;
+
+  /* FIXME lto: current_function_decl is not set when this function is called,
+     so we cannot find the personality of the current function. For now we
+     return true here to avoid a crash. */
+  if (!current_function_decl)
+    return true;
+
+  personality_decl = DECL_FUNCTION_PERSONALITY (current_function_decl);
 
 #ifdef MIPS_DEBUGGING_INFO
   return false;
@@ -146,11 +155,7 @@ dwarf2out_do_cfi_asm (void)
   if (!flag_dwarf2_cfi_asm || !dwarf2out_do_frame ())
     return false;
 
-  /* FIXME lto: current_function_decl is not set when this function is called,
-     so we cannot find the personality of the current function. For now we
-     use the global eh_personality_decl, but this is probably wrong for the
-     case of a program with decls with different personality functions. */
-  if (saved_do_cfi_asm || !eh_personality_decl || !current_function_decl)
+  if (saved_do_cfi_asm || !personality_decl)
     return true;
 
   if (!HAVE_GAS_CFI_PERSONALITY_DIRECTIVE)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]