The recent change to mips_loongson_ext2_prefetch_cookie had a couple
minor bugs which showed up in a mips bootstrap.

First it has an unused argument "locality".  Assuming the argument is
mandated by an API/ABI, the easiest way to shut up the compiler for the
unused argument is to drop its name from the function signature, which
is precisely what this patch does.

Second, the compiler thinks we can drop off the end of the function
without returning a value.  Based on my reading we're only going to get
a load or store here, so that can never happen in practice.  So I've put
a gcc_unreachable at the end of the function.

This silences both warnings.  My tester has bootstrapped mipsisa32r2 as
well as built glibc and a linux kernel with this patch.

Installing on the trunk momentarily.

Jeff
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e0225c58ffb..b7f3b71d897 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2018-11-09  Jeff Law  <l...@redhat.com>
+
+       * config/mips/mips.c (mips_loongson_ext2_prefetch_cookie): Handle
+       unused argument better.  Add gcc_unreachable to silence warning.
+
 2018-11-09  Martin Sebor  <mse...@redhat.com>
 
        PR middle-end/81824
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index d78e2056ec2..17a2a66956e 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -15155,7 +15155,7 @@ mips_prefetch_cookie (rtx write, rtx locality)
    (prefetch for store), other hint just scale to hint = 0 and hint = 1.  */
 
 rtx
-mips_loongson_ext2_prefetch_cookie (rtx write, rtx locality)
+mips_loongson_ext2_prefetch_cookie (rtx write, rtx)
 {
   /* store.  */
   if (INTVAL (write) == 1)
@@ -15164,6 +15164,8 @@ mips_loongson_ext2_prefetch_cookie (rtx write, rtx 
locality)
   /* load.  */
   if (INTVAL (write) == 0)
     return GEN_INT (INTVAL (write));
+
+  gcc_unreachable ();
 }
 
 

Reply via email to