Compile error in include/prtypes.h with gcc-11 - mismatched types
Categories
(NSPR :: NSPR, defect)
Tracking
(Not tracked)
People
(Reporter: jthackray, Unassigned)
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15
Steps to reproduce:
Trying to compile NSS using NSPR with gcc-11, I get compile warnings/errors (using -Werror)
Actual results:
Here's what gcc-11 says:
gcc -o Linux5.8_x86_64_gcc_glibc_PTH_64_OPT.OBJ/Linux_SINGLE_SHLIB/drbg.o -c -std=c99 -O2 -fPIC -m64 -pipe -ffunction-sections -fdata-sections -DHAVE_STRERROR -DLINUX -Dlinux -Wall -Wshadow -Werror -DXP_UNIX -DXP_UNIX -UDEBUG -DNDEBUG -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -DSQL_MEASURE_USE_TEMP_DIR -D_REENTRANT -DSHLIB_SUFFIX="so" -DSHLIB_PREFIX="lib" -DSHLIB_VERSION="3" -DSOFTOKEN_SHLIB_VERSION="3" -DRIJNDAEL_INCLUDE_TABLES -UDEBUG -DNDEBUG -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -DSQL_MEASURE_USE_TEMP_DIR -D_REENTRANT -DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -DNSS_USE_64 -DFREEBL_NO_DEPEND -DFREEBL_LOWHASH -DNSS_X86_OR_X64 -DNSS_X64 -DNSS_BEVAND_ARCFOUR -DMPI_AMD64 -DMP_ASSEMBLY_MULTIPLY -DNSS_USE_COMBA -DMP_IS_LITTLE_ENDIAN -DUSE_HW_AES -DINTEL_GCM -DHAVE_INT128_SUPPORT -DMP_API_COMPATIBLE -I../../../dist/Linux5.8_x86_64_gcc_glibc_PTH_64_OPT.OBJ/include -I../../../dist/public/nss -I../../../dist/private/nss -Impi -Iecl -Iverified -Iverified/kremlin/include -Iverified/kremlin/kremlib/dist/minimal -Ideprecated drbg.c
In file included from ../../../dist/Linux5.8_x86_64_gcc_glibc_PTH_64_OPT.OBJ/include/prerror.h:9,
from drbg.c:9:
drbg.c: In function ‘RNG_RandomUpdate’:
../../../dist/Linux5.8_x86_64_gcc_glibc_PTH_64_OPT.OBJ/include/prtypes.h:556:38: error: argument 1 of type ‘int[1]’ with mismatched bound [-Werror=array-parameter=]
556 | extern void pr_static_assert(int arg[(condition) ? 1 : -1])
| ^
drbg.c:577:5: note: in expansion of macro ‘PR_STATIC_ASSERT’
577 | PR_STATIC_ASSERT(((size_t)-1) > (size_t)1);
| ^~~~~~~~~~~~~~~~
../../../dist/Linux5.8_x86_64_gcc_glibc_PTH_64_OPT.OBJ/include/prtypes.h:556:38: note: previously declared as ‘int *’
556 | extern void pr_static_assert(int arg[(condition) ? 1 : -1])
| ^
drbg.c:475:9: note: in expansion of macro ‘PR_STATIC_ASSERT’
475 | PR_STATIC_ASSERT(sizeof(bytes) >= SHA256_LENGTH);
| ^~~~~~~~~~~~~~~~
drbg.c: In function ‘PRNGTEST_RunHealthTests’:
../../../dist/Linux5.8_x86_64_gcc_glibc_PTH_64_OPT.OBJ/include/prtypes.h:556:38: error: argument 1 of type ‘int[1]’ with mismatched bound [-Werror=array-parameter=]
556 | extern void pr_static_assert(int arg[(condition) ? 1 : -1])
| ^
drbg.c:915:5: note: in expansion of macro ‘PR_STATIC_ASSERT’
915 | PR_STATIC_ASSERT(sizeof(rng_known_result) >= sizeof(rng_reseed_result));
| ^~~~~~~~~~~~~~~~
../../../dist/Linux5.8_x86_64_gcc_glibc_PTH_64_OPT.OBJ/include/prtypes.h:556:38: note: previously declared as ‘int *’
556 | extern void pr_static_assert(int arg[(condition) ? 1 : -1])
| ^
drbg.c:475:9: note: in expansion of macro ‘PR_STATIC_ASSERT’
475 | PR_STATIC_ASSERT(sizeof(bytes) >= SHA256_LENGTH);
| ^~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[8]: *** [../../coreconf/rules.mk:292: Linux5.8_x86_64_gcc_glibc_PTH_64_OPT.OBJ/Linux_SINGLE_SHLIB/drbg.o] Error 1
Expected results:
Compiled successfully without warnings.
Description
•