* tests/test-dynarray.c (value_at): Avoid undefined behavior
in signed integer multiplication.
* tests/test-scratch-buffer.c (byte_at): Likewise, for the
theoretically-possible case where size_t is narrower than int.
+2021-03-21 Paul Eggert <eggert@cs.ucla.edu>
+
+ tests: fix signed overflow issues
+ * tests/test-dynarray.c (value_at): Avoid undefined behavior
+ in signed integer multiplication.
+ * tests/test-scratch-buffer.c (byte_at): Likewise, for the
+ theoretically-possible case where size_t is narrower than int.
+
2021-03-21 Bruno Haible <bruno@clisp.org>
doc: More updates.
#define N 100000
static int
-value_at (int i)
+value_at (long long int i)
{
return (i % 13) + ((i * i) % 251);
}
#include "macros.h"
static int
-byte_at (size_t i)
+byte_at (unsigned long long int i)
{
return ((i % 13) + ((i * i) % 251)) & 0xff;
}