aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.cc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2023-11-13 09:24:08 +0100
committerRichard Biener <rguenther@suse.de>2023-11-13 15:00:39 +0100
commit5021fa7076acd5a987362c8695ae3ebeff877d02 (patch)
tree89381db0e025554ea5e0cc2022eacf0c24bbf084 /gcc/tree-inline.cc
parenta0b2abef4e62d816f669df478a3cc320647c3b31 (diff)
downloadgcc-5021fa7076acd5a987362c8695ae3ebeff877d02.zip
gcc-5021fa7076acd5a987362c8695ae3ebeff877d02.tar.gz
gcc-5021fa7076acd5a987362c8695ae3ebeff877d02.tar.bz2
middle-end/112487 - inline and parameter mismatch
When passing an aggregate to a implicitly declared function that's later declared as receiving a register type we can run into a sanity assert that cannot hold for such gross mismatches. Instead of asserting avoid emitting a debug temp that's invalid. PR middle-end/112487 * tree-inline.cc (setup_one_parameter): When the parameter is unused only insert a debug bind when there's not a gross mismatch in value and declared parameter type. Do not assert there effectively isn't. * gcc.dg/torture/pr112487.c: New testcase.
Diffstat (limited to 'gcc/tree-inline.cc')
-rw-r--r--gcc/tree-inline.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc
index 00d0510..0b14118 100644
--- a/gcc/tree-inline.cc
+++ b/gcc/tree-inline.cc
@@ -3562,7 +3562,11 @@ setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn,
it. */
if (optimize && gimple_in_ssa_p (cfun) && !def && is_gimple_reg (p))
{
- gcc_assert (!value || !TREE_SIDE_EFFECTS (value));
+ /* When there's a gross type mismatch between the passed value
+ and the declared argument type drop it on the floor and do
+ not bother to insert a debug bind. */
+ if (value && !is_gimple_reg_type (TREE_TYPE (value)))
+ return NULL;
return insert_init_debug_bind (id, bb, var, rhs, NULL);
}