Protect tree_to_shwi call in unmodified_param_1
Richard Sandiford
richard.sandiford@arm.com
Mon Aug 5 08:58:00 GMT 2019
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?
Richard
2019-08-05 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* 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)));
More information about the Gcc-patches
mailing list