This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, CHKP] [always_inline 2/2] Fix segafult in SRA
- From: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 16 Jan 2015 14:09:44 +0300
- Subject: [PATCH, CHKP] [always_inline 2/2] Fix segafult in SRA
- Authentication-results: sourceware.org; auth=none
Hi,
In early SRA some_callers_have_mismatched_arguments_p function is called for function, all its thunks and aliases, but actually cannot handle function with thunks because assumes call_stmt for call_edge is not NULL. This patch rejects functions with thunks instead of ICE.
Bootstrapped and checked on x86_64-unknown-linux-gnu. Fixes faults revealed by the first patch in the series. OK for trunk?
Thanks,
Ilya
--
2015-01-16 Ilya Enkovich <ilya.enkovich@intel.com>
* tree-sra.c (some_callers_have_mismatched_arguments_p): Allow thunk
callers.
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index f560fe0..f6a3acd 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -4873,7 +4873,7 @@ some_callers_have_mismatched_arguments_p (struct cgraph_node *node,
{
struct cgraph_edge *cs;
for (cs = node->callers; cs; cs = cs->next_caller)
- if (!callsite_arguments_match_p (cs->call_stmt))
+ if (!cs->call_stmt || !callsite_arguments_match_p (cs->call_stmt))
return true;
return false;