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]

Re: [PATCH] Merge from LTO: eh_personality changes


On 09/10/2009 07:52 AM, Richard Guenther wrote:
Doesn't seem to work.  Instead I tried to fall back to
the gcc personality for detecting empty type lists, again setting
a cfi personality for all functions we emit.  But that doesn't work
either (it seems catch (...) doesn't work with the gcc personality,
g++.dg/eh/loop1.C fails).

Interesting. I wouldn't have expected that. Though your patch doesn't seem to indicate that:

+ 	case ERT_CATCH:
+ 	  /* An empty type list is ok with the default C EH personality.  */
+ 	  if (i->u.eh_catch.type_list)
+ 	    return true;
+ 	  break;

	* langhooks-def.h (LANG_HOOKS_INIT_EH): Define.
	(LANG_HOOKS_EH_RUNTIME_TYPE): Likewise.
	(LANG_HOOKS_INITIALIZER): Adjust.
	(lhd_pass_through_t): Declare.
	* langhooks.h (struct lang_hooks): Add init_eh and eh_runtime_type.
	* langhooks.c (lhd_pass_through_t): New function.
...
* toplev.c (eh_personality_decl): New.

I'm surprised you're not taking the opportunity to make the eh_personality_thingy a proper lang hook.

+ 	case ERT_MUST_NOT_THROW:
+ 	case ERT_CLEANUP:
+ 	  /* Ok with the default C EH personality.  */
+ 	  break;

MUST_NOT_THROW is not ok with default personality. You'll wind up invoking abort instead of std::terminate.

*** gcc/fortran/f95-lang.c.orig	2009-09-10 13:40:45.000000000 +0200
--- gcc/fortran/f95-lang.c	2009-09-10 14:18:42.000000000 +0200
*************** gfc_maybe_initialize_eh (void)
*** 1155,1164 ****
       return;

     gfc_eh_initialized_p = true;
!   eh_personality_libfunc
!     = init_one_libfunc (USING_SJLJ_EXCEPTIONS
!                        ? "__gcc_personality_sj0"
!                        : "__gcc_personality_v0");
     default_init_unwind_resume_libfunc ();
     using_eh_for_cleanups ();
   }
--- 1155,1164 ----
       return;

     gfc_eh_initialized_p = true;
!   eh_personality_decl
!     = build_personality_function (USING_SJLJ_EXCEPTIONS
! 				  ? "__gcc_personality_sj0"
! 				  : "__gcc_personality_v0");

Surely Fortran can simply avoid setting this up at all?


+ rtx
+ get_personality_function (tree decl)
+ {
+   tree personality = DECL_FUNCTION_PERSONALITY (decl);
+   tree name;
+
+   if (!personality&&  !eh_personality_decl)
+     return NULL;
+
+   if (!personality)
+     return init_one_libfunc (USING_SJLJ_EXCEPTIONS
+ 			     ? "__gcc_personality_sj0"
+ 			     : "__gcc_personality_v0");
+
+   name = DECL_ASSEMBLER_NAME (personality);
+
+   return init_one_libfunc (IDENTIFIER_POINTER (name));
+ }

Why in the world are you extracting the name and invoking init_one_libfunc instead of using the DECL_RTL of the function_decl? And what's with the eh_personality_decl check at this point?



r~



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