Bug Summary

File:pr/Linux4.19_x86_64_gcc_glibc_PTH_64_DBG.OBJ/pr/tests/../../../pr/tests/lazyinit.c
Warning:line 65, column 17
Value stored to 'interval' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name lazyinit.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/var/lib/jenkins/workspace/nss-scan-build/nspr/Linux4.19_x86_64_gcc_glibc_PTH_64_DBG.OBJ/pr/tests -fcoverage-compilation-dir=/var/lib/jenkins/workspace/nss-scan-build/nspr/Linux4.19_x86_64_gcc_glibc_PTH_64_DBG.OBJ/pr/tests -resource-dir /usr/lib/llvm-18/lib/clang/18 -U NDEBUG -D DEBUG_jenkins -D PACKAGE_NAME="" -D PACKAGE_TARNAME="" -D PACKAGE_VERSION="" -D PACKAGE_STRING="" -D PACKAGE_BUGREPORT="" -D PACKAGE_URL="" -D DEBUG=1 -D HAVE_VISIBILITY_HIDDEN_ATTRIBUTE=1 -D HAVE_VISIBILITY_PRAGMA=1 -D XP_UNIX=1 -D _GNU_SOURCE=1 -D HAVE_FCNTL_FILE_LOCKING=1 -D HAVE_POINTER_LOCALTIME_R=1 -D LINUX=1 -D HAVE_DLADDR=1 -D HAVE_GETTID=1 -D HAVE_LCHOWN=1 -D HAVE_SETPRIORITY=1 -D HAVE_STRERROR=1 -D HAVE_SYSCALL=1 -D HAVE_SECURE_GETENV=1 -D _REENTRANT=1 -D FORCE_PR_LOG -D _PR_PTHREADS -U HAVE_CVAR_BUILT_ON_SEM -I /var/lib/jenkins/workspace/nss-scan-build/nss/../dist/Linux4.19_x86_64_gcc_glibc_PTH_64_DBG.OBJ/include -I ../../../pr/include -I ../../../pr/include/private -internal-isystem /usr/lib/llvm-18/lib/clang/18/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -ferror-limit 19 -fvisibility=hidden -fgnuc-version=4.2.1 -fno-inline -analyzer-output=html -analyzer-config stable-report-filename=true -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2024-05-18-082241-28900-1 -x c ../../../pr/tests/lazyinit.c
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6/*
7** File: lazyinit.c
8** Description: Testing lazy initialization
9**
10** Since you only get to initialize once, you have to rerun the test
11** for each test case. The test cases are numbered. If you want to
12** add more tests, take the next number and add it to the switch
13** statement.
14**
15** This test is problematic on systems that don't support the notion
16** of console output. The workarounds to emulate that feature include
17** initializations themselves, which defeats the purpose here.
18*/
19
20#include "prcvar.h"
21#include "prenv.h"
22#include "prinit.h"
23#include "prinrval.h"
24#include "prio.h"
25#include "prlock.h"
26#include "prlog.h"
27#include "prthread.h"
28#include "prtypes.h"
29
30#include <stdio.h>
31#include <stdlib.h>
32
33static void PR_CALLBACK lazyEntry(void *arg)
34{
35 PR_ASSERT(NULL == arg)((((void*)0) == arg)?((void)0):PR_Assert("NULL == arg","../../../pr/tests/lazyinit.c"
,35))
;
36} /* lazyEntry */
37
38
39int main(int argc, char **argv)
40{
41 PRUintn pdkey;
42 PRStatus status;
43 char *path = NULL((void*)0);
44 PRDir *dir = NULL((void*)0);
45 PRLock *ml = NULL((void*)0);
46 PRCondVar *cv = NULL((void*)0);
47 PRThread *thread = NULL((void*)0);
48 PRIntervalTime interval = 0;
49 PRFileDesc *file, *udp, *tcp, *pair[2];
50 PRIntn test;
51
52 if ( argc < 2)
53 {
54 test = 0;
55 }
56 else {
57 test = atoi(argv[1]);
58 }
59
60 switch (test)
61 {
62 case 0: ml = PR_NewLock();
63 break;
64
65 case 1: interval = PR_SecondsToInterval(1);
Value stored to 'interval' is never read
66 break;
67
68 case 2: thread = PR_CreateThread(
69 PR_USER_THREAD, lazyEntry, NULL((void*)0), PR_PRIORITY_NORMAL,
70 PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0);
71 break;
72
73 case 3: file = PR_Open("./tmp-", PR_RDONLY0x01, 0);
74 break;
75
76 case 4: udp = PR_NewUDPSocket();
77 break;
78
79 case 5: tcp = PR_NewTCPSocket();
80 break;
81
82 case 6: dir = PR_OpenDir("./tmp-");
83 break;
84
85 case 7: (void)PR_NewThreadPrivateIndex(&pdkey, NULL((void*)0));
86 break;
87
88 case 8: path = PR_GetEnv("PATH");
89 break;
90
91 case 9: status = PR_NewTCPSocketPair(pair);
92 break;
93
94 case 10: PR_SetConcurrency(2);
95 break;
96
97 default:
98 printf(
99 "lazyinit: unrecognized command line argument: %s\n",
100 argv[1] );
101 printf( "FAIL\n" );
102 exit( 1 );
103 break;
104 } /* switch() */
105 return 0;
106} /* Lazy */
107
108/* lazyinit.c */