aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-01-21 14:25:46 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-01-21 14:25:46 +0000
commitc54e3854ad73ce0c5f0e70782c7d7ba184521272 (patch)
treec29551acd700f7afa035e60d6d0bab2f9c14a3c2 /gcc/tree-inline.c
parent41b72e59160c9c5bda6dc0cb15359048ea9c21a6 (diff)
downloadgcc-c54e3854ad73ce0c5f0e70782c7d7ba184521272.zip
gcc-c54e3854ad73ce0c5f0e70782c7d7ba184521272.tar.gz
gcc-c54e3854ad73ce0c5f0e70782c7d7ba184521272.tar.bz2
re PR tree-optimization/34885 (ICE in copy_reference_ops_from_ref, at tree-ssa-sccvn.c:574)
2008-01-21 Richard Guenther <rguenther@suse.de> PR c/34885 * tree-inline.c (setup_one_parameter): Deal with mismatched types using a VIEW_CONVERT_EXPR. * gcc.c-torture/compile/pr34885.c: New testcase. From-SVN: r131694
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 1fe0847..636e37d 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1444,7 +1444,16 @@ setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn,
if (value
&& value != error_mark_node
&& !useless_type_conversion_p (TREE_TYPE (p), TREE_TYPE (value)))
- rhs = fold_build1 (NOP_EXPR, TREE_TYPE (p), value);
+ {
+ if (fold_convertible_p (TREE_TYPE (p), value))
+ rhs = fold_build1 (NOP_EXPR, TREE_TYPE (p), value);
+ else
+ /* ??? For valid (GIMPLE) programs we should not end up here.
+ Still if something has gone wrong and we end up with truly
+ mismatched types here, fall back to using a VIEW_CONVERT_EXPR
+ to not leak invalid GIMPLE to the following passes. */
+ rhs = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (p), value);
+ }
/* If the parameter is never assigned to, has no SSA_NAMEs created,
we may not need to create a new variable here at all. Instead, we may