diff options
author | Martin Jambor <mjambor@suse.cz> | 2019-09-30 10:18:59 +0200 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2019-09-30 10:18:59 +0200 |
commit | be525d9221f61c17e0fa34823ffd1624b0f8518a (patch) | |
tree | 8674735d0491388b7801692da4d645704aa61b17 /gcc/ipa-param-manipulation.c | |
parent | 15bbad92434a184a0baac0c93c7111e6e7fcd9c2 (diff) | |
download | gcc-be525d9221f61c17e0fa34823ffd1624b0f8518a.zip gcc-be525d9221f61c17e0fa34823ffd1624b0f8518a.tar.gz gcc-be525d9221f61c17e0fa34823ffd1624b0f8518a.tar.bz2 |
[PR 91853] Prevent IPA-SRA ICEs on type-mismatched calls
2019-09-30 Martin Jambor <mjambor@suse.cz>
PR ipa/91853
* tree-inline.c (force_value_to_type): New function.
(setup_one_parameter): Use force_value_to_type to convert type.
* tree-inline.c (force_value_to_type): Declare.
* ipa-param-manipulation.c (ipa_param_adjustments::modify_call): Deal
with register type mismatches.
testsuite/
* gcc.dg/ipa/pr91853.c: New test.
From-SVN: r276296
Diffstat (limited to 'gcc/ipa-param-manipulation.c')
-rw-r--r-- | gcc/ipa-param-manipulation.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/ipa-param-manipulation.c b/gcc/ipa-param-manipulation.c index 913b96f..bbf6467 100644 --- a/gcc/ipa-param-manipulation.c +++ b/gcc/ipa-param-manipulation.c @@ -651,8 +651,15 @@ ipa_param_adjustments::modify_call (gcall *stmt, bool deref_base = false; unsigned int deref_align = 0; if (TREE_CODE (base) != ADDR_EXPR - && POINTER_TYPE_P (TREE_TYPE (base))) - off = build_int_cst (apm->alias_ptr_type, apm->unit_offset); + && is_gimple_reg_type (TREE_TYPE (base))) + { + /* Detect type mismatches in calls in invalid programs and make a + poor attempt to gracefully convert them so that we don't ICE. */ + if (!POINTER_TYPE_P (TREE_TYPE (base))) + base = force_value_to_type (ptr_type_node, base); + + off = build_int_cst (apm->alias_ptr_type, apm->unit_offset); + } else { bool addrof; |