Reproducer:
Spawn a host using ubuntu2004-arm64-large (-small should work too).
Execute the following steps from a WiredTiger repo:
. test/evergreen/find_cmake.sh mkdir cmake_build && cd cmake_build $CMAKE -DCMAKE_BUILD_TYPE=ASan -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/mongodbtoolchain_v4_clang.cmake -DHAVE_BUILTIN_EXTENSION_LZ4=1 -DHAVE_BUILTIN_EXTENSION_SNAPPY=1 -DHAVE_BUILTIN_EXTENSION_ZLIB=1 -DHAVE_BUILTIN_EXTENSION_ZSTD=1 -G Ninja ../. ninja
You should observe the following error messages:
../ext/encryptors/rotn/rotn_encrypt.c:153:51: error: implicit conversion changes signedness: 'int' to 'char' [-Werror,-Wsign-conversion] buf[i] = ((buf[i] - 'a') + rotn) % 26 + 'a'; ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ ../ext/encryptors/rotn/rotn_encrypt.c:155:51: error: implicit conversion changes signedness: 'int' to 'char' [-Werror,-Wsign-conversion] buf[i] = ((buf[i] - 'A') + rotn) % 26 + 'A';
This fixes the compilation warnings but I have not done any testing:
diff --git a/examples/c/ex_encrypt.c b/examples/c/ex_encrypt.c index ce94394..f8657b3 100644 --- a/examples/c/ex_encrypt.c +++ b/examples/c/ex_encrypt.c @@ -110,9 +110,9 @@ do_rotate(char *buf, size_t len, int rotn) for (i = 0; i < len; i++) if (isalpha((unsigned char)buf[i])) { if (islower((unsigned char)buf[i])) - buf[i] = ((buf[i] - 'a') + rotn) % 26 + 'a'; + buf[i] = (char)(((buf[i] - 'a') + rotn) % 26 + 'a'); else - buf[i] = ((buf[i] - 'A') + rotn) % 26 + 'A'; + buf[i] = (char)(((buf[i] - 'A') + rotn) % 26 + 'A'); } } diff --git a/ext/encryptors/rotn/rotn_encrypt.c b/ext/encryptors/rotn/rotn_encrypt.c index ccf87c6..6b05a12 100644 --- a/ext/encryptors/rotn/rotn_encrypt.c +++ b/ext/encryptors/rotn/rotn_encrypt.c @@ -150,9 +150,9 @@ do_rotate(char *buf, size_t len, int rotn) */ for (i = 0; i < len; i++) { if ('a' <= buf[i] && buf[i] <= 'z') - buf[i] = ((buf[i] - 'a') + rotn) % 26 + 'a'; + buf[i] = (char)(((buf[i] - 'a') + rotn) % 26 + 'a'); else if ('A' <= buf[i] && buf[i] <= 'Z') - buf[i] = ((buf[i] - 'A') + rotn) % 26 + 'A'; + buf[i] = (char)(((buf[i] - 'A') + rotn) % 26 + 'A'); } }