dbtool.c:75:15: error: type of ‘sftkdb_known_attributes_size’ does not match original declaration [-Werror=lto-type-mismatch]
Categories
(NSS :: Libraries, defect)
Tracking
(Not tracked)
People
(Reporter: nvinson234, Unassigned)
Details
Attachments
(1 file)
Steps to reproduce:
- export CFLAGS="-march=native -O3 -flto=auto -pipe -Wno-error -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -ffat-lto-objects"
- export CXXFLAGS="-march=native -O3 -flto=auto -pipe -Wno-error -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -ffat-lto-objects"
- export CPPFLAGS="-I/usr/include/nspr"
- export XCFLAGS="${CFLAGS} -D_FILE_OFFSET_BITS=64"
- make -C coreconf CC=x86_64-pc-linux-gnu-gcc USE_64=1
- export XCFLAGS="${CFLAGS} ${CPPFLAGS} -D_FILE_OFFSET_BITS=64"
- make CC=x86_64-pc-linux-gnu-gcc CCC=x86_64-pc-linux-gnu-g++ 'AR=x86_64-pc-linux-gnu-ar rc $@' RANLIB=x86_64-pc-linux-gnu-ranlib OPTIMIZER= USE_64=1 disable_ckbi=0 NSINSTALL="${PWD}/$(find -type f -name nsinstall)" -C . OS_TEST=x86_64
- Observe error
Actual results:
Build fails with following error message:
dbtool.c:75:15: error: type of ‘sftkdb_known_attributes_size’ does not match original declaration [-Werror=lto-type-mismatch]
75 | extern size_t sftkdb_known_attributes_size;
| ^
Expected results:
nss should build successfully.
| Reporter | ||
Comment 1•9 months ago
|
||
This bug report is based on the Gentoo bug report: https://bugs.gentoo.org/961590
The procedure given above is based on the steps Gentoo's portage takes when building nss.
| Reporter | ||
Comment 2•9 months ago
|
||
Following additional information provided by Eli Schwartz:
Link-Time Optimization is a massively global compiler optimization pass which is pretty handy for producing faster executables. It also has the interesting property that because the compiler does whole-program analysis using bytecode, it can save type information and perform error checks that it normally doesn’t have enough insight for. In particular, checking for ODR issues and checking function type signature mismatches.
Note that all the -Werror=* flags are used to help detect cases where the compiler tries to optimize by assuming UB cannot exist in the source code -- if it does exist, ordinarily the code would be miscompiled, and this says to make the miscompilation a fatal error.
| Reporter | ||
Comment 3•9 months ago
|
||
Additional update. I've created a github PR to fix this issue. https://github.com/nss-dev/nss/pull/31
Thanks.
| Reporter | ||
Comment 4•9 months ago
|
||
sftkdb_known_attributes_size is defined with conflicting types. In /lib/softtoken/sdb.c it is defined as a 'const size_t'; whereas in lib/softtoken/sftkdbti.h it is defined as an 'unsigned int'. The correct type for sftkdb_known_attributes_size is size_t since its value is derived from the size of the sftkdb_known_attributes array.
Comment 5•9 months ago
|
||
This bug is now fixed. closing.
Description
•