[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

llvm / clang / scan-build of the Hurd



Hi :)

I've been playing with the Clang Static Analyzer. I noticed that while
clang does not work, scan-build does (see below):

% cat test.c
int main() { return 0; }
% clang -v test.c
Debian clang version 3.2-11 (tags/RELEASE_32/final) (based on LLVM 3.2)
Target: i386-pc--gnu
Thread model: posix
 "" -cc1 -triple i386-pc--gnu -S -disable-free -disable-llvm-verifier -main-file-name test.c -mrelocation-model static -mdisable-fp-elim -fmath-errno -mconstructor-aliases -target-cpu pentium4 -target-linker-version 2.23.52.20130727 -momit-leaf-frame-pointer -v -resource-dir ../lib/clang/3.2 -fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem /usr/include/clang/3.2/include/ -fno-dwarf-directory-asm -fdebug-compilation-dir /home/teythoon/clang -ferror-limit 19 -fmessage-length 170 -mstackrealign -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/test-1pgoyA.s -x c test.c
error: unable to execute command: posix_spawn failed: No such file or directory
error: clang frontend command failed due to signal (use -v to see invocation)
Debian clang version 3.2-11 (tags/RELEASE_32/final) (based on LLVM 3.2)
Target: i386-pc--gnu
Thread model: posix
note: diagnostic msg: PLEASE submit a bug report to http://bugs.debian.org/ and include the crash backtrace, preprocessed source, and associated run script.
error: unable to execute command: posix_spawn failed: No such file or directory
note: diagnostic msg: Error generating preprocessed source(s).

Note the "", on my linux box that reads "/usr/bin/clang"
instead. Thoughts?

The static analyzer is good at spotting errors, see [0] for a partial
build of the Hurd using scan-build. The build aborts for some reason,
I haven't investigated this further yet.

0: http://teythoon.cryptobitch.de/qa/2013-10-17/scan-build-2/

I whipped up some patches for some of these reports, I'll send them as
soon as I tested rebuilt packages.

Clang does not support nested functions [1], and there is no plan to
support them upstream. As such, any file that uses nested functions
(or any gcc extension not supported by clang) is excluded from the
analysis (see e.g. [2]). Richard has no special love for them, iiuc
b/c the semantic is not too well defined. I propose to deprecate their
use for the Hurd and to gradually rewrite the code that uses them,
starting with the core libraries, to make it possible to analyze them
using the static analyzer.

1:
http://clang.llvm.org/docs/UsersManual.html#gcc-extensions-not-implemented-yet

2:
http://teythoon.cryptobitch.de/qa/2013-10-17/scan-build-2/failures/clang_other_error_0BJHH4.i.stderr.txt

Cheers,
Justus

Attachment: signature.asc
Description: signature


Reply to: