Closed Bug 1738028 Opened 2 years ago Closed 2 years ago

nss 3.71 fails to build with llvm 13

Categories

(NSS :: Build, defect, P5)

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gaston, Assigned: jschanck)

Details

(Whiteboard: [nss-fx])

Attachments

(1 file)

while testing llvm 13 on OpenBSD, it seems nss last release fails to build on https://hg.mozilla.org/projects/nss/file/tip/lib/certhigh/certvfypkix.c#l819:


cc -o OpenBSD7.0_64_OPT.OBJ/certvfypkix.o -c -std=c99 -O -fPIC -DPIC  -Wall -Wno-switch -pipe -DOPENBSD -Wall -Ws    hadow -Qunused-arguments -Wno-parentheses-equality -Wno-array-bounds -Wno-unevaluated-expression -Werror -DXP_UNIX     -UDEBUG -DNDEBUG -pthread -DNSS_DISABLE_AVX2 -DNSS_NO_INIT_SUPPORT -DSEED_ONLY_DEV_URANDOM -DUSE_UTIL_DIRECTLY -DNO    _NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -I/usr/local/include/nspr -I../../../dist/OpenBSD7.0_6    4_OPT.OBJ/include -I../../../dist/public/nss -I../../../dist/private/nss -I/usr/local/include -O2 -pipe   certvfypkix.c
 certvfypkix.c:819:9: error: variable 'errLevel' set but not used [-Werror,-Wunused-but-set-variable]
int errLevel = 0;
        ^
1 error generated.

it seems like a wrong false positive from llvm, as the var seems used afterwards. strange ?

I reproduced this with llvm main by building with ./build.sh --clang --enable-libpkix --opt. The errLevel variable actually is unused with this configuration, as the later PR_LOG calls are ifdef'd out.

:gaston, could you confirm that the attached patch fixes the issue?

Assignee: nobody → jschanck
Severity: -- → S4
Status: NEW → ASSIGNED
OS: OpenBSD → All
Priority: -- → P5
Hardware: Unspecified → All
Version: 3.71 → trunk

what's strange to me is that some lines below errLevel is incremented, but i guess that's optimized out by the compiler since no tests are done on the value itself...

testing this commit, the build fails layer on with:

 lib/freebl/shvfy.c:blapi_SHVerifyFile(), shvfy.c:337:9: error: variable 'count' set but not used

at which point you start wondering if it wouldnt make sense to use -Wno-unused-but-set-variable if we want to keep -Werror

Whiteboard: [nss-fx]

those were the only two errors for set but unused vars, nss 3.71 built with a similar fix applied for the count variable

Ah, yeah, that file is only built in FIPS mode. I've updated the patch, and we'll look into building with a more recent clang in CI.

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:jschanck, could you have a look please?
For more information, please visit auto_nag documentation.

Flags: needinfo?(jschanck)
Flags: needinfo?(bbeurdouche)
Flags: needinfo?(jschanck)
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Flags: needinfo?(bbeurdouche)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: