Muffle GCC warnings in various ways.
[u/mdw/catacomb] / symm / square.c
index f3056de..73b22bb 100644 (file)
@@ -92,10 +92,26 @@ void square_init(square_ctx *k, const void *buf, size_t sz)
   }
   nr = 8;
 
   }
   nr = 8;
 
+  /* --- GCC complains about an out-of-bounds subscript here --- *
+   *
+   * This is impossible.  Thanks to @KSZ_ASSERT@, we know that @sz <= 16@ and
+   * hence @i <= nk <= 4@; but @SQUARE_KWORDS == 36@.
+   */
+
+#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
+
+  ww = kk[i - 1];
+
+#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+#  pragma GCC diagnostic pop
+#endif
+
   /* --- Expand this material to fill the rest of the table --- */
 
   nw = (nr + 1) * 4;
   /* --- Expand this material to fill the rest of the table --- */
 
   nw = (nr + 1) * 4;
-  ww = kk[i - 1];
   p = RCON;
   for (; i < nw; i++) {
     uint32 w = kk[i - nk];
   p = RCON;
   for (; i < nw; i++) {
     uint32 w = kk[i - nk];