]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rs6000: Skip overload instances with NULL fntype [PR104967]
authorKewen Lin <linkw@linux.ibm.com>
Thu, 24 Mar 2022 01:46:06 +0000 (20:46 -0500)
committerKewen Lin <linkw@linux.ibm.com>
Thu, 24 Mar 2022 01:47:14 +0000 (20:47 -0500)
For some overload built-in function instance, if it requires
a data type which isn't defined on the target, its fntype
would be initialized as NULL.  This patch is to consider
this possibility in function find_instance, as shown in
PR104967.

PR target/104967

gcc/ChangeLog:

* config/rs6000/rs6000-c.cc (find_instance): Skip instances with null
function types.

gcc/config/rs6000/rs6000-c.cc

index 2f0f4fe337d11ffb1cc44fed91a84a8d7c1b0048..84bb98f94fb62e8cfbcdc9cdb5378a33f3f3e5d4 100644 (file)
@@ -1686,6 +1686,10 @@ find_instance (bool *unsupported_builtin, ovlddata **instance,
 
   ovlddata *inst = *instance;
   gcc_assert (inst != NULL);
+  /* It is possible for an instance to require a data type that isn't
+     defined on this target, in which case inst->fntype will be NULL.  */
+  if (!inst->fntype)
+    return error_mark_node;
   tree fntype = rs6000_builtin_info[inst->bifid].fntype;
   tree parmtype0 = TREE_VALUE (TYPE_ARG_TYPES (fntype));
   tree parmtype1 = TREE_VALUE (TREE_CHAIN (TYPE_ARG_TYPES (fntype)));