ramosian-glider / sanitizers

0 stars 0 forks source link

Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!") #68

Closed ramosian-glider closed 9 years ago

ramosian-glider commented 9 years ago

Originally reported on Google Code with ID 67

$ cat stub.c 
int t = 0;
void __asan_unregister_globals() { }

$ clang -c stub.c
# Everything ok

$ clang -c -faddress-sanitizer stub.c
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function
cast, file /Users/glider/src/asan/llvm/include/llvm/Support/Casting.h, line 194.
0  clang             0x0000000101505aa2 PrintStackTrace(void*) + 34
1  clang             0x0000000101506099 SignalHandler(int) + 777
2  libSystem.B.dylib 0x00007fff85e051ba _sigtramp + 26
3  libSystem.B.dylib 0x0000000102832a90 _sigtramp + 2091047152
4  clang             0x0000000101505ce6 abort + 22
5  clang             0x0000000101505ca7 __assert_rtn + 55
6  clang             0x0000000100ab6ab8 (anonymous namespace)::AddressSanitizer::runOnModule(llvm::Module&)
+ 13160
7  clang             0x00000001014a54b4 llvm::MPPassManager::runOnModule(llvm::Module&)
+ 292
8  clang             0x00000001014a5a32 llvm::PassManagerImpl::run(llvm::Module&) +
242
9  clang             0x00000001014a5bdd llvm::PassManager::run(llvm::Module&) + 13
10 clang             0x000000010014abb8 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::Module*, clang::BackendAction, llvm::raw_ostream*) + 4872
11 clang             0x0000000100234d82 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
+ 594
12 clang             0x0000000100268d96 clang::ParseAST(clang::Sema&, bool, bool) +
390
13 clang             0x0000000100233e5b clang::CodeGenAction::ExecuteAction() + 1291
14 clang             0x000000010002529a clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
+ 1002
15 clang             0x000000010000bdfb clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
+ 3147
16 clang             0x0000000100002d8d cc1_main(char const**, char const**, char const*,
void*) + 5453
17 clang             0x000000010000800a main + 682
18 clang             0x0000000100001834 start + 52
19 clang             0x000000000000002c start + 4294961196
Stack dump:
0.  Program arguments: /Users/glider/src/asan/llvm/build/Release+Asserts/bin/clang -cc1
-triple x86_64-apple-macosx10.6.0 -emit-obj -mrelax-all -disable-free -main-file-name
stub.c -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2
-target-linker-version 127.2 -coverage-file stub.o -resource-dir /Users/glider/src/asan/llvm/build/Release+Asserts/bin/../lib/clang/3.1
-fmodule-cache-path /var/tmp/clang-module-cache -fdebug-compilation-dir /Users/glider/src/chrome-commit/src
-ferror-limit 19 -fmessage-length 180 -faddress-sanitizer -stack-protector 1 -mstackrealign
-fblocks -fobjc-dispatch-method=mixed -fobjc-default-synthesize-properties -fdiagnostics-show-option
-fcolor-diagnostics -o stub.o -x c stub.c 
1.  <eof> parser at end of file
2.  Per-module optimization passes
3.  Running pass 'AddressSanitizer' on module 'stub.c'.
clang: error: unable to execute command: Illegal instruction
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang: note: diagnostic msg: Please submit a bug report to http://llvm.org/bugs/ and
include command line arguments and all diagnostic information.
clang: note: diagnostic msg: Preprocessed source(s) and associated run script(s) are
located at:
clang: note: diagnostic msg: /tmp/stub-mm3mOY.i
clang: note: diagnostic msg: /tmp/stub-mm3mOY.sh

Reported by ramosian.glider on 2012-04-20 13:02:14

ramosian-glider commented 9 years ago
>> void __asan_unregister_globals() { }
Why would you do that? 

Reported by konstantin.s.serebryany on 2012-04-20 13:29:16

ramosian-glider commented 9 years ago
In fact _you_ did this in asan_stub.c :)
I'm going to compile it without -faddress-sanitizer, but I think we still have to fix
this bug, don't we?

Reported by ramosian.glider on 2012-04-20 13:32:23

ramosian-glider commented 9 years ago

Reported by konstantin.s.serebryany on 2012-04-20 13:34:08

ramosian-glider commented 9 years ago
http://codereview.appspot.com/6080046/ should fix the issue.

Reported by ramosian.glider on 2012-04-20 15:43:01

ramosian-glider commented 9 years ago
Fixed in Clang r155346.

Reported by ramosian.glider on 2012-04-23 10:48:58

ramosian-glider commented 9 years ago

Reported by ramosian.glider on 2012-09-13 13:42:51

ramosian-glider commented 9 years ago
Adding Project:AddressSanitizer as part of GitHub migration.

Reported by ramosian.glider on 2015-07-30 09:12:59