This is the mail archive of the 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]

Protect tree_to_shwi call in unmodified_param_1

unmodified_param_1 used tree_to_shwi without first checking
tree_fits_shwi_p.  This is needed by the SVE ACLE support and
is hard to test independently.

Tested on aarch64-linux-gnu, armeb-eabi and x86_64-linux-gnu.
OK to install?


2019-08-05  Richard Sandiford  <>

	* ipa-fnsummary.c (unmodified_parm_1): Test tree_fits_shwi_p
	before calling to tree_to_shwi.

Index: gcc/ipa-fnsummary.c
--- gcc/ipa-fnsummary.c	2019-07-16 09:11:50.509067138 +0100
+++ gcc/ipa-fnsummary.c	2019-08-05 09:57:28.553617299 +0100
@@ -927,7 +927,8 @@ unmodified_parm_1 (ipa_func_body_info *f
   /* SSA_NAME referring to parm default def?  */
   if (TREE_CODE (op) == SSA_NAME
       && SSA_NAME_IS_DEFAULT_DEF (op)
-      && TREE_CODE (SSA_NAME_VAR (op)) == PARM_DECL)
+      && TREE_CODE (SSA_NAME_VAR (op)) == PARM_DECL
+      && tree_fits_shwi_p (TYPE_SIZE (TREE_TYPE (op))))
       if (size_p)
 	*size_p = tree_to_shwi (TYPE_SIZE (TREE_TYPE (op)));

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