Bug Summary

File:daq/roisend/tools/dump_roi.cc
Warning:line 56, column 5
Value stored to 'is' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -O3 -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name dump_roi.cc -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -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 -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -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=/data/b2soft/buildbot/development/build -fcoverage-compilation-dir=/data/b2soft/buildbot/development/build -resource-dir /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/lib/clang/21 -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/c++ -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/c++/x86_64-redhat-linux -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/c++/backward -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/include -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/python3.12 -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/include/CLHEP -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/Geant4 -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/include/root -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/include/belle_legacy -I include/ -D _PACKAGE_="daq" -D G4UI_USE_TCSH -D RaveDllExport= -D HAS_SQLITE -D HAS_CALLGRIND -I include -I /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/libxml2 -internal-isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/bin/../lib64/gcc/x86_64-redhat-linux/15.2.0/../../../../include/c++ -internal-isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/bin/../lib64/gcc/x86_64-redhat-linux/15.2.0/../../../../include/c++/x86_64-redhat-linux -internal-isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/bin/../lib64/gcc/x86_64-redhat-linux/15.2.0/../../../../include/c++/backward -internal-isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/lib/clang/21/include -internal-isystem /usr/local/include -internal-isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/bin/../lib64/gcc/x86_64-redhat-linux/15.2.0/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-missing-braces -Wno-unused-command-line-argument -std=c++20 -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -vectorize-loops -vectorize-slp -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /scan_build/2026-05-31-004316-385593-1 -x c++ daq/roisend/tools/dump_roi.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <arpa/inet.h>
10
11#include <stdio.h>
12#include <unistd.h>
13#include <time.h>
14#include <sys/time.h>
15#include <vector>
16
17enum { OFFSET_LENGTH = 0, OFFSET_HEADER = 1, OFFSET_TRIGNR = 2, OFFSET_RUNNR = 3, OFFSET_ROIS = 4};
18enum {
19 EXP_MASK = 0xFFC00000,
20 EXP_SHIFT = 22,
21 RUNNO_MASK = 0x003FFF00,
22 RUNNO_SHIFT = 8,
23 SUBRUNNO_MASK = 0x000000FF
24};
25
26
27using namespace std;
28
29char* timestamp()
30{
31 struct timeval tb;
32 struct tm* tp;
33 static char buf[256];
34 // struct tm result;
35 gettimeofday(&tb, NULL__null);
36 tp = localtime(&tb.tv_sec);
37 sprintf(buf, "%02d:%02d:%02d.%03d ",
38 tp->tm_hour, tp->tm_min, tp->tm_sec, (int)(tb.tv_usec / 1000));
39 // printf ( " buf = %s\n", buf );
40 return buf;
41}
42
43
44
45int main(int /*argc*/, char** /*argv*/)
46{
47 vector<unsigned int> buf(400000);
48 int infn = fileno(stdinstdin);
49 printf("infn = %d\n", infn);
50
51 int nrec = 0;
52 for (;;) {
53 int is = read(infn, &buf[0], 4);
54 int nw = ntohl(buf[0])__bswap_32 (buf[0]);
55 if (is <= 0) break;
56 is = read(infn, &buf[1], (nw - 1) * 4);
Value stored to 'is' is never read
57 // printf ( "nw = %d\n", nw );
58 // if ( abs(nw)> 1000 ) continue;
59 // for ( int j=0;j<8; j++ ) {
60 // printf ( "%8.8x ", buf[j] );
61 // }
62 // printf ( "\n" );
63 // printf ( "nw = %d, 1st = %d, 2nd = %d, 3rd = %d\n",
64 // ntohl(buf[5]), ntohl(buf[6]), ntohl(buf[7]), ntohl(buf[8]) );
65 int exp = (ntohl(buf[ OFFSET_RUNNR ])__bswap_32 (buf[ OFFSET_RUNNR ]) & EXP_MASK) >> EXP_SHIFT;
66 int run = (ntohl(buf[ OFFSET_RUNNR ])__bswap_32 (buf[ OFFSET_RUNNR ]) & RUNNO_MASK) >> RUNNO_SHIFT;
67 int evt = ntohl(buf[ OFFSET_TRIGNR ])__bswap_32 (buf[ OFFSET_TRIGNR ]);
68 // int rois = ntohl(buf[ OFFSET_ROIS] );
69
70 printf("%s Nrec: %d ; Nw: %d ; Exp: %d, Run: %d, Evt: %d\n",
71 timestamp(), nrec, nw, exp, run, evt);
72 nrec++;
73
74 }
75 return 0;
76}