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]

[PATCH] Remove current_function_decl usage from get_polymorphic_call_info


Hi,

Testing 'mpx' branch after merge with trunk I got a segfault in ipa-devirt.c.  It appears that cgraph_node cloning with indirect edge causes call to get_polymorphic_call_info which uses current_function_decl.  It happens in IPA pass and therefore current_function_decl is NULL which causes segfault.  Also even within a GIMPLE pass it seems wrong to use current_function_decl because examined call may belong to another function and passed fndecl should be used instead.

Proposed patch was bootstrapped and regtested on linux-x86_64.  OK for trunk?

Thanks,
Ilya
--

2014-08-13  Ilya Enkovich  <ilya.enkovich@intel.com>

	* ipa-devirt.c (get_polymorphic_call_info): Use fndecl instead of
	current_function_decl.


diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 3650b43..0f38655 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -2319,7 +2319,7 @@ get_polymorphic_call_info (tree fndecl,
 		     = decl_maybe_in_construction_p (base,
 						     context->outer_type,
 						     call,
-						     current_function_decl);
+						     fndecl);
 		  return base;
 		}
 	      else


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