We should avoid mismatched argument values (integers for pointers)
when doing modref queries. This is the third place to guard.
2022-04-06 Richard Biener <rguenther@suse.de>
PR ipa/105166
* ipa-modref-tree.cc (modref_access_node::get_ao_ref ): Bail
out for non-pointer arguments.
* gcc.dg/torture/pr105166.c: New testcase.
{
tree arg;
- if (!parm_offset_known || !(arg = get_call_arg (stmt)))
+ if (!parm_offset_known
+ || !(arg = get_call_arg (stmt))
+ || !POINTER_TYPE_P (TREE_TYPE (arg)))
return false;
poly_offset_int off = (poly_offset_int)offset
+ ((poly_offset_int)parm_offset << LOG2_BITS_PER_UNIT);
--- /dev/null
+/* { dg-do compile } */
+
+int bar (foo, a)
+ int (**foo) ();
+ int a;
+{
+ (foo)[1] = bar;
+ foo[1] (1);
+}