Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ramosian-glider opened this issue Aug 31, 2015 · 7 comments

Comments

@ramosian-glider
Copy link
Member

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
Copy link
Member Author

>> void __asan_unregister_globals() { }
Why would you do that? 

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

@ramosian-glider
Copy link
Member Author

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
Copy link
Member Author

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

  • Labels added: Priority-Low
  • Labels removed: Priority-Medium

@ramosian-glider
Copy link
Member Author

http://codereview.appspot.com/6080046/ should fix the issue.

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

@ramosian-glider
Copy link
Member Author

Fixed in Clang r155346.

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

  • Status changed: Fixed

@ramosian-glider
Copy link
Member Author

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

  • Labels added: OpSys-All

@ramosian-glider
Copy link
Member Author

Adding Project:AddressSanitizer as part of GitHub migration.

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

  • Labels added: ProjectAddressSanitizer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant