Re: Clang 3.3 Analyzer Results

From: Jeffrey Walton <noloader(at)gmail(dot)com>
To: Tomas Vondra <tv(at)fuzzy(dot)cz>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Clang 3.3 Analyzer Results
Date: 2013-11-11 18:17:12
Message-ID: CAH8yC8mSzkxCLtreQFbiayGF-rexZ0dc6GvHO+pXjsqAhFmGAg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Mon, Nov 11, 2013 at 2:00 AM, Tomas Vondra <tv(at)fuzzy(dot)cz> wrote:
>
>> Would someone know the best way to get this to the right folks?
>>
>> Thanks in advance. (And sorry reporting to pgsql-general - the
>> developer list states emails must go elsewhere first).
>
> IMHO pgsql-hackers is the right audience for reports like this. The 'must
> ask somewhere else first' is meant for regular questions that are not that
> closely related to postgresql development, and are likely to be answered
> in the generic mailing lists.
>
> Please, upload the HTML report somewhere and post a link. If it's easier
> to the clang analysis, maybe post instructions on how to do that.
The instructions are kind of easy when they are given as a recipe.
They get a little more involved when they steps have to be explained.

The recipes are below and include building Clang 3.3 from sources. The
Clang recipe lacks a couple of copies - for example,
`asan_symbolize.py` needs to be copied into $PREFIX because `make
install` does not do it. Keep the build directory around until you
have everything you need.

The Analyzer is invoked with scan-build. Its used when compiling the
package because it performs static analysis.

The Santizers are invoked with the runtime flags. They are used with
the `check` program because they perform dynamic analysis. The more
self test the better.

Jeff

##############
# Clang 3.3

# Run from a scratch directory, delete when finished

wget http://llvm.org/releases/3.3/llvm-3.3.src.tar.gz
wget http://llvm.org/releases/3.3/cfe-3.3.src.tar.gz
wget http://llvm.org/releases/3.3/compiler-rt-3.3.src.tar.gz
# wget http://llvm.org/releases/3.3/lldb-3.3.src.tar.gz
tar xvf llvm-3.3.src.tar.gz
cd llvm-3.3.src/tools
tar xvf ../../cfe-3.3.src.tar.gz
mv cfe-3.3.src clang
# tar xvf ../../lldb-3.3.src.tar.gz
# mv lldb-3.3.src/ lldb
cd ..
cd projects
tar xvf ../../compiler-rt-3.3.src.tar.gz
mv compiler-rt-3.3.src/ compiler-rt
cd ..
./configure --enable-optimized --prefix=/usr/local
make -j4
sudo make install

# Install does not install scan-build and scan-view
# Perform the copy, and/or put them on-path
sudo mkdir /usr/local/bin/scan-build
sudo cp -r tools/clang/tools/scan-build /usr/local/bin
sudo mkdir /usr/local/bin/scan-view
sudo cp -r tools/clang/tools/scan-view /usr/local/bin

##############
# Scan-view

make distclean

export CC="/usr/local/bin/clang"
export CXX="/usr/local/bin/clang++"

/usr/local/bin/scan-build/scan-build
--use-analyzer=/usr/local/bin/clang ./configure

/usr/local/bin/scan-build/scan-build --use-analyzer=/usr/local/bin/clang make

##############
# Sanitizers

make distclean

export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib/clang/3.3/lib/darwin/
export CC=/usr/local/bin/clang
export CXX=/usr/local/bin/clang++
export CFLAGS="-g3 -fsanitize=address -fsanitize=undefined"
export CXXFLAGS="-g3 -fsanitize=address -fsanitize=undefined -fno-sanitize=vptr"

./configure

make

make check 2>&1 | asan_symbolize.py

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message J Smith 2013-11-11 18:42:39 Errors regarding non-existent files in pg_subtrans
Previous Message whiplash 2013-11-11 16:39:04 Save many data chunks to file

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2013-11-11 18:39:12 Re: regclass error reports improperly downcased
Previous Message Bruce Momjian 2013-11-11 17:57:37 MVCC snapshot timing