Antique-team / clangml

OCaml bindings for clang
Other
24 stars 6 forks source link

crash with ocaml 4.02.1 #51

Closed UnixJunkie closed 9 years ago

UnixJunkie commented 10 years ago

https://gist.github.com/UnixJunkie/0960292213eb4612bf18

UnixJunkie commented 9 years ago

same problem with 4.02.0

UnixJunkie commented 9 years ago

works with 4.00.1

UnixJunkie commented 9 years ago

In the clang command-line:

-analyzer-checker=external.OCaml

is the option that crashes clang

UnixJunkie commented 9 years ago

the full clang command-line:

 "/usr/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -disable-free -disable-llvm-verifier -main-file-name d0095.c -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 2.24 -v -resource-dir /usr/bin/../lib/clang/3.4 -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/clang/3.4/include -internal-externc-isystem /usr/lib/gcc/x86_64-linux-gnu/4.8/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /home/berenger/src/clangml-released -ferror-limit 19 -fmessage-length 125 -mstackrealign -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -load _build/clangml.dylib -analyze -analyzer-checker=external.OCaml -x c plugin/testsuite/d0095.c
pippijn commented 9 years ago

-analyzer-checker=external.OCaml

Of course it is.. without that, there is none of our code being executed. I'll look into it later this week.

UnixJunkie commented 9 years ago

Here is an strace of the crash: https://gist.github.com/UnixJunkie/1fda849e8f8c0e1834ea

pippijn commented 9 years ago

I'm not sure how this worked before. It might be broken on older versions, now. If it is, then both 0 and Val_unit need to be checked.

pippijn commented 9 years ago

Also, a tip on how to debug this: 1) open clang/clang/api.ml, prepend "gdb"; "--args"; to the argument list (argv) where clang is called. Change "clang" to "/usr/bin/clang" (or whatever the full path of clang is). 2) run processor.native on some file 3) when gdb opens, enter "set follow-fork-mode on" 4) "run" (in gdb)

UnixJunkie commented 9 years ago

Thanks a lot for the fix, I am testing it right now.

UnixJunkie commented 9 years ago

thanks a lot for the info

UnixJunkie commented 9 years ago
2015-05-21 18:27:49.716 INFO : transformations end
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff7fcf780 (LWP 30044)]
0x00007ffff4893674 in camlClang__Invariants__fun_1611 ()
    at clang/clang/invariants.ml:8
8         DenseIntMap.iter (fun idx ctyp ->
UnixJunkie commented 9 years ago

It still crashes, but later

UnixJunkie commented 9 years ago

when handling a request of type 'CacheFor Cache_ctyp' in plugin/ocaml/clangPlugin.ml

UnixJunkie commented 9 years ago

I am looking at this right now.

UnixJunkie commented 9 years ago

make prtp in memcad is all OK right now using master of clangml. If this is OK, I will tag, make a new release and close that bug.