-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Not Needed
Problem:
/src/mc-range-encoding.c fails to compile with clang 7.0.1 on Ubuntu 18.04 with -Werror ernabled. This is the build environment for MongoDB 6.0 sanitizer builds. Eror does not occur with Gcc.
Repro:
cmake -DCMAKE_C_FLAGS="-Werror" -DCMAKE_C_COMPILER=/opt/mongodbtoolchain/v3/bin/clang -DCMAKE_CXX_COMPILER=/opt/mongodbtoolchain/v3/bin/clang++ -GNinja
Errors:
[16/394] Building C object CMakeFiles/mongocrypt.dir/src/mc-range-encoding.c.o FAILED: CMakeFiles/mongocrypt.dir/src/mc-range-encoding.c.o /opt/mongodbtoolchain/v3/bin/clang -DBSON_STATIC -DKMS_MSG_STATIC -DMLIB_HAVE_STRINGS_H -DMLIB_USER -DMONGOCRYPT_LITTLE_ENDIAN -Dmongocrypt_EXPORTS -I/home/ubuntu/src/libmongocrypt/kms-message/src -I/home/ubuntu/src/libmongocrypt/src -I/home/ubuntu/src/libmongocrypt/repro/src -I/home/ubuntu/src/libmongocrypt/repro/_deps/embedded_mcd-src/src/libbson/src -I/home/ubuntu/src/libmongocrypt/repro/_mongo-c-driver/src/libbson/src -I/home/ubuntu/src/libmongocrypt/repro/_mongo-c-driver/src/libbson/src/bson -fPIC -Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=ignored-qualifiers -Werror=uninitialized -fPIC -pthread -std=gnu99 -MD -MT CMakeFiles/mongocrypt.dir/src/mc-range-encoding.c.o -MF CMakeFiles/mongocrypt.dir/src/mc-range-encoding.c.o.d -o CMakeFiles/mongocrypt.dir/src/mc-range-encoding.c.o -c /home/ubuntu/src/libmongocrypt/src/mc-range-encoding.c /home/ubuntu/src/libmongocrypt/src/mc-range-encoding.c:193:20: error: implicit conversion loses floating-point precision: 'double' to 'float' [-Werror,-Wconversion] if (isinf (args.value) || isnan (args.value)) { ~~~~~~~~~~~~^~~~~~ /usr/include/math.h:661:46: note: expanded from macro 'isinf' # define isinf(x) __MATH_TG ((x), __isinf, (x)) ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/math.h:559:16: note: expanded from macro '__MATH_TG' ? FUNC ## f ARGS \ ~~~~~~~~~ ^~~~ /home/ubuntu/src/libmongocrypt/src/mc-range-encoding.c:193:42: error: implicit conversion loses floating-point precision: 'double' to 'float' [-Werror,-Wconversion] if (isinf (args.value) || isnan (args.value)) { ~~~~~~~~~~~~^~~~~~ /usr/include/math.h:644:46: note: expanded from macro 'isnan' # define isnan(x) __MATH_TG ((x), __isnan, (x)) ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/math.h:559:16: note: expanded from macro '__MATH_TG' ? FUNC ## f ARGS \ ~~~~~~~~~ ^~~~ /home/ubuntu/src/libmongocrypt/src/mc-range-encoding.c:247:21: error: implicit conversion loses floating-point precision: 'double' to 'float' [-Werror,-Wconversion] if (isfinite (range)) { ~~~~~~~~~~^~~~~~ /usr/include/math.h:629:50: note: expanded from macro 'isfinite' # define isfinite(x) __MATH_TG ((x), __finite, (x)) ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/math.h:559:16: note: expanded from macro '__MATH_TG' ? FUNC ## f ARGS \ ~~~~~~~~~ ^~~~ /home/ubuntu/src/libmongocrypt/src/mc-range-encoding.c:254:24: error: implicit conversion loses floating-point precision: 'double' to 'float' [-Werror,-Wconversion] if (isfinite (rangeAndPrecision)) { ~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/math.h:629:50: note: expanded from macro 'isfinite' # define isfinite(x) __MATH_TG ((x), __finite, (x)) ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/math.h:559:16: note: expanded from macro '__MATH_TG' ? FUNC ## f ARGS \ ~~~~~~~~~ ^~~~ 4 errors generated.