[cfe-dev] scan-build failure

Michael Blumenkrantz mike at zentific.com
Sun Aug 29 20:27:31 PDT 2010


Hi,

I have a C project which fails to build with scan-build.  It can be accessed at
http://svn.zentific.com/trunk/Zentific-console/shellinabox and checked out from
the same path using svn.  and built with the usual autoreconf -fi &&
scan-build ./configure && scan-build make.  The problem is that it is
incorrectly failing function detection tests (isnan and strcasestr) during
configure.

This is the output:

Running autoreconf...
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
Configuring...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... /usr/bin/ccc-analyzer
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /usr/bin/ccc-analyzer accepts -g... yes
checking for /usr/bin/ccc-analyzer option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of /usr/bin/ccc-analyzer... gcc3
checking how to run the C preprocessor... /usr/bin/ccc-analyzer -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... no
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... no
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by /usr/bin/ccc-analyzer... /usr/x86_64-pc-linux-gnu/bin/ld
checking if the linker (/usr/x86_64-pc-linux-gnu/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 98304
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/x86_64-pc-linux-gnu/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from /usr/bin/ccc-analyzer
object... ok checking for dlfcn.h... yes
checking for objdir... .libs
checking if /usr/bin/ccc-analyzer supports -fno-rtti -fno-exceptions... no
checking for /usr/bin/ccc-analyzer option to produce PIC... -fPIC -DPIC
checking if /usr/bin/ccc-analyzer PIC flag -fPIC -DPIC works... yes
checking if /usr/bin/ccc-analyzer static flag -static works... yes
checking if /usr/bin/ccc-analyzer supports -c -o file.o... yes
checking if /usr/bin/ccc-analyzer supports -c -o file.o... (cached) yes
checking whether the /usr/bin/ccc-analyzer linker
(/usr/x86_64-pc-linux-gnu/bin/ld -m elf_x86_64) supports shared libraries...
yes checking whether -lc should be explicitly linked in... no checking dynamic
linker characteristics... GNU/Linux ld.so checking how to hardcode library
paths into programs... immediate checking for shl_load... no
checking for shl_load in -ldld... no
checking for dlopen... no
checking for dlopen in -ldl... no
checking for dlopen in -lsvld... no
checking for dld_link in -ldld... no
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for an ANSI C-conforming const... no
checking whether /usr/bin/ccc-analyzer needs -traditional... no
checking for __attribute__... no
checking libutil.h usability... no
checking libutil.h presence... no
checking for libutil.h... no
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking pty.h usability... yes
checking pty.h presence... yes
checking for pty.h... yes
checking for strings.h... (cached) yes
checking sys/prctl.h usability... yes
checking sys/prctl.h presence... yes
checking for sys/prctl.h... yes
checking sys/uio.h usability... yes
checking sys/uio.h presence... yes
checking for sys/uio.h... yes
checking util.h usability... no
checking util.h presence... no
checking for util.h... no
checking utmp.h usability... yes
checking utmp.h presence... yes
checking for utmp.h... yes
checking utmpx.h usability... yes
checking utmpx.h presence... yes
checking for utmpx.h... yes
checking for login_tty... no
checking for login_tty in -lutil... no
checking for strlcat... no
checking for getgrgid_r... no
checking for getgrnam_r... no
checking for getpwnam_r... no
checking for getpwuid_r... no
checking for openpty... no
checking for strcasestr... no
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for OPENSSL... yes
checking security/pam_appl.h usability... yes
checking security/pam_appl.h presence... yes
checking for security/pam_appl.h... yes
checking security/pam_client.h usability... yes
checking security/pam_client.h presence... yes
checking for security/pam_client.h... yes
checking security/pam_misc.h usability... yes
checking security/pam_misc.h presence... yes
checking for security/pam_misc.h... yes
checking for security/pam_appl.h... (cached) yes
checking for security/pam_misc.h... (cached) yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating demo/Makefile
config.status: creating logging/Makefile
config.status: creating libhttp/Makefile
config.status: creating shellinabox/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
scan-build: Removing directory '/tmp/scan-build-2010-08-29-8' because it
contains no reports.

Running make...
scan-build: Emitting reports for this run to '/tmp/scan-build-2010-08-29-8'.
make  all-recursive
Making all in demo
make[2]: Nothing to be done for `all'.
Making all in logging
  CC     logging.lo
ANALYZE: logging.c debugMsg
ANALYZE: logging.c debug
ANALYZE: logging.c info
ANALYZE: logging.c warn
ANALYZE: logging.c error
ANALYZE: logging.c message
ANALYZE: logging.c fatal
ANALYZE: logging.c logIsDebug
ANALYZE: logging.c logIsInfo
ANALYZE: logging.c logIsWarn
ANALYZE: logging.c logIsError
ANALYZE: logging.c logIsMessage
ANALYZE: logging.c logIsQuiet
ANALYZE: logging.c logIsDefault
ANALYZE: logging.c logIsVerbose
ANALYZE: logging.c logSetLogLevel
ANALYZE: logging.c vStringPrintf
logging.c:167:7: warning: Assigned value is garbage or undefined
      check(buf = realloc(buf, offset + len));
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
logging.c:167:13: note: instantiated from:
      check(buf = realloc(buf, offset + len));
            ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~
logging.c:149:3: warning: Assigned value is garbage or undefined
  check(buf     = realloc(buf, offset + len));
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
logging.c:149:9: note: instantiated from:
  check(buf     = realloc(buf, offset + len));
        ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~
logging.c:155:5: warning: Assigned value is garbage or undefined
    check(buf   = realloc(buf, offset + p + 1));
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
logging.c:155:11: note: instantiated from:
    check(buf   = realloc(buf, offset + p + 1));
          ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
logging.c:157:5: warning: Allocated memory never released. Potential memory
leak. check(vsnprintf(buf + offset, p + 1, fmt, aq) == p);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from logging.c:53:
../logging/logging.h:61:23: note: instantiated from:
                      fatal("Check failed at "__FILE__":%d in %s(): %s",      \
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ANALYZE: logging.c stringPrintf
4 diagnostics generated.
  CCLD   liblogging.la
Making all in libhttp
  CC     hashmap.lo
  CC     trie.lo
ANALYZE: hashmap.c newHashMap
ANALYZE: hashmap.c initHashMap
ANALYZE: hashmap.c destroyHashMap
ANALYZE: trie.c newTrie
ANALYZE: hashmap.c deleteHashMap
ANALYZE: hashmap.c stringHashFunc
ANALYZE: hashmap.c addToHashMap
ANALYZE: trie.c initTrie
ANALYZE: trie.c destroyTrie
ANALYZE: trie.c deleteTrie
ANALYZE: trie.c addLeafToTrie
trie.c:105:3: warning: Allocated memory never released. Potential memory leak.
  check(trie->children  = malloc(sizeof(struct Trie)));
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from trie.c:52:
../logging/logging.h:61:23: note: instantiated from:
                      fatal("Check failed at "__FILE__":%d in %s(): %s",      \
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
trie.c:108:25: warning: Allocated memory never released. Potential memory leak.
  trie->children->value = value;
  ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
ANALYZE: trie.c addToTrie
hashmap.c:155:3: warning: Allocated memory never released. Potential memory
leak. return value;
  ^
hashmap.c:149:3: warning: Allocated memory never released. Potential memory
leak. check(hashmap->entries[idx]    = realloc(hashmap->entries[idx],
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from hashmap.c:52:
../logging/logging.h:61:23: note: instantiated from:
                      fatal("Check failed at "__FILE__":%d in %s(): %s",      \
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ANALYZE: hashmap.c deleteFromHashMap
ANALYZE: hashmap.c getRefFromHashMap
ANALYZE: hashmap.c getFromHashMap
ANALYZE: hashmap.c iterateOverHashMap
ANALYZE: hashmap.c getHashmapSize
2 diagnostics generated.
trie.c:163:5: warning: Assigned value is garbage or undefined
    check(trie->children          = realloc(
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
trie.c:163:17: note: instantiated from:
    check(trie->children          = realloc(
                ^                   ~~~~~~~~
trie.c:123:9: warning: Allocated memory never released. Potential memory leak.
        check(child->key          = malloc(trie->idx - i - 1));
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from trie.c:52:
../logging/logging.h:61:23: note: instantiated from:
                      fatal("Check failed at "__FILE__":%d in %s(): %s",      \
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
trie.c:169:7: warning: Allocated memory never released. Potential memory leak.
      addLeafToTrie(newNode, *key, key + 1, len - 1, value);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
trie.c:143:9: warning: Allocated memory never released. Potential memory leak.
        return;
        ^
trie.c:172:35: warning: Allocated memory never released. Potential memory leak.
      newNode->value              = value;
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
ANALYZE: trie.c getFromTrie
  CC     httpconnection.lo
httpconnection.c:71:1: warning: "isnan" redefined
In file included from httpconnection.c:52:
/usr/include/math.h:257:1: warning: this is the location of the previous
definition httpconnection.c:214: error: conflicting types for 'strcasestr'
/usr/include/string.h:371: note: previous declaration of 'strcasestr' was here
httpconnection.c: In function 'httpDestroyHeaders':
httpconnection.c:274: warning: unused parameter 'arg'
make[2]: *** [httpconnection.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
7 diagnostics generated.
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
scan-build: 15 bugs found.
scan-build: Run 'scan-view /tmp/scan-build-2010-08-29-8' to examine bug reports.


-- 
Mike Blumenkrantz
Zentific: Our boolean values are huge.



More information about the cfe-dev mailing list