The initialization of compat builtins assumes the builtin we are creating
a compatible builtin for exists and ICEs if it doesn't.  However, there are
valid reasons why some builtins are disabled for a particular compile.
In this case, the MMA builtins are disabled for -mcpu=440 (and other cpus),
so instead of ICEing, we should just skip adding the MMA compat builtin.

This passed bootstrap and regtesting on powerpc64-linux, with running the
testsuite in both 32-bit and 64-bit modes, with no regressions.
Ok for mainline?

The compat builtin patch was approved for backporting to GCC10, so we'll
need this fix to go along with it.

Peter


2021-02-25  Peter Bergner  <berg...@linux.ibm.com>

gcc/
        PR target/99279
        * config/rs6000/rs6000-call.c (rs6000_init_builtins): Replace assert
        with an "if" test.

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index d2bd03e..f567625 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -13468,9 +13468,9 @@ rs6000_init_builtins (void)
   for (i = 0; i < ARRAY_SIZE (bdesc_compat); i++, d++)
     {
       tree decl = rs6000_builtin_decls[(int)d->code];
-      gcc_assert (decl != NULL);
-      add_builtin_function (d->name, TREE_TYPE (decl), (int)d->code,
-                           BUILT_IN_MD, NULL, NULL_TREE);
+      if (decl != NULL)
+       add_builtin_function (d->name, TREE_TYPE (decl), (int)d->code,
+                             BUILT_IN_MD, NULL, NULL_TREE);
     }
 }
 

Reply via email to