Open LFsWang opened 3 years ago
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // RUN: %soll %s contract HelloWorld { struct Test { int x; int y; } function sayHello(string _name) public pure returns (string) { return _name; } } contract Base { function zz() { uint a; ++a; } } /* contract AA { function pp() { int a; (a,); } } contract SafeMath { event Transfer(address indexed _from, address indexed _to, uint256 _value); function add(uint256 a, uint256 b) public returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); emit Transfer(address(123), address(456), c); return c; } } */
==50310==ERROR: AddressSanitizer: new-delete-type-mismatch on 0x61b000003f80 in thread T0: object passed to delete has wrong type: size of the allocated type: 1536 bytes; size of the deallocated type: 1536 bytes. alignment of the allocated type: default-aligned; alignment of the deallocated type: 8 bytes. #0 0x7f270b824bcd in operator delete(void*, unsigned long, std::align_val_t) (/lib/x86_64-linux-gnu/libasan.so.5+0x111bcd) #1 0x5598fea0b81b in llvm::deallocate_buffer(void*, unsigned long, unsigned long) /usr/lib/llvm-10/include/llvm/Support/Compiler.h:574 #2 0x5598fea25c57 in llvm::DenseMap<std::pair<llvm::AnalysisKey*, llvm::Module*>, std::_List_iterator<std::pair<llvm::AnalysisKey*, std::unique_ptr<llvm::detail::AnalysisResultConcept<llvm::Module, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>::Invalidator>, std::default_delete<llvm::detail::AnalysisResultConcept<llvm::Module, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>::Invalidator> > > > >, llvm::DenseMapInfo<std::pair<llvm::AnalysisKey*, llvm::Module*> >, llvm::detail::DenseMapPair<std::pair<llvm::AnalysisKey*, llvm::Module*>, std::_List_iterator<std::pair<llvm::AnalysisKey*, std::unique_ptr<llvm::detail::AnalysisResultConcept<llvm::Module, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>::Invalidator>, std::default_delete<llvm::detail::AnalysisResultConcept<llvm::Module, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>::Invalidator> > > > > > >::~DenseMap() /usr/lib/llvm-10/include/llvm/ADT/DenseMap.h:725 #3 0x5598fea1feb6 in llvm::AnalysisManager<llvm::Module>::~AnalysisManager() /usr/lib/llvm-10/include/llvm/IR/PassManager.h:608 #4 0x5598fea169b4 in soll::EmitAssemblyHelper::EmitAssembly(soll::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) /code/lib/CodeGen/BackendUtil.cpp:242 #5 0x5598fea16d43 in soll::EmitBackendOutput(soll::DiagnosticsEngine&, soll::CodeGenOptions const&, soll::TargetOptions const&, llvm::DataLayout const&, llvm::Module*, soll::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) /code/lib/CodeGen/BackendUtil.cpp:253 #6 0x5598fe9d82fa in soll::BackendConsumer::compileAndLink(llvm::Module&) (/code/build/tools/soll/soll+0x155b2fa) #7 0x5598fe9dbb61 in soll::BackendConsumer::HandleSourceUnit(soll::ASTContext&, soll::SourceUnit&) (/code/build/tools/soll/soll+0x155eb61) #8 0x5598fece22e0 in soll::ParseAST(soll::Sema&, soll::ASTConsumer&, soll::ASTContext&, bool) /code/lib/Parse/ParseAST.cpp:30 #9 0x5598fe9a18b0 in soll::ASTFrontendAction::ExecuteAction() /code/lib/Frontend/FrontendAction.cpp:111 #10 0x5598fe9a09c0 in soll::FrontendAction::Execute() /code/lib/Frontend/FrontendAction.cpp:79 #11 0x5598fe92a1db in soll::CompilerInstance::ExecuteAction(soll::FrontendAction&) /code/lib/Frontend/CompilerInstance.cpp:328 #12 0x5598fe9b5ee3 in soll::ExecuteCompilerInvocation(soll::CompilerInstance*) /code/lib/FrontendTool/ExecuteCompilerInvocation.cpp:48 #13 0x5598fe8ddf54 in main /code/tools/soll/main.cpp:34 #14 0x7f2705ad00b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) #15 0x5598fe8dd2dd in _start (/code/build/tools/soll/soll+0x14602dd) 0x61b000003f80 is located 0 bytes inside of 1536-byte region [0x61b000003f80,0x61b000004580) allocated by thread T0 here: #0 0x7f270b822947 in operator new(unsigned long) (/lib/x86_64-linux-gnu/libasan.so.5+0x10f947) #1 0x7f2707b34710 (/usr/lib/llvm-10/lib/libLLVM-10.so.1+0xab5710) #2 0x5598fea16d43 in soll::EmitBackendOutput(soll::DiagnosticsEngine&, soll::CodeGenOptions const&, soll::TargetOptions const&, llvm::DataLayout const&, llvm::Module*, soll::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) /code/lib/CodeGen/BackendUtil.cpp:253 #3 0x5598fe9d82fa in soll::BackendConsumer::compileAndLink(llvm::Module&) (/code/build/tools/soll/soll+0x155b2fa) #4 0x5598fe9dbb61 in soll::BackendConsumer::HandleSourceUnit(soll::ASTContext&, soll::SourceUnit&) (/code/build/tools/soll/soll+0x155eb61) #5 0x5598fece22e0 in soll::ParseAST(soll::Sema&, soll::ASTConsumer&, soll::ASTContext&, bool) /code/lib/Parse/ParseAST.cpp:30 #6 0x5598fe9a18b0 in soll::ASTFrontendAction::ExecuteAction() /code/lib/Frontend/FrontendAction.cpp:111 #7 0x5598fe9a09c0 in soll::FrontendAction::Execute() /code/lib/Frontend/FrontendAction.cpp:79 #8 0x5598fe92a1db in soll::CompilerInstance::ExecuteAction(soll::FrontendAction&) /code/lib/Frontend/CompilerInstance.cpp:328 #9 0x5598fe9b5ee3 in soll::ExecuteCompilerInvocation(soll::CompilerInstance*) /code/lib/FrontendTool/ExecuteCompilerInvocation.cpp:48 #10 0x5598fe8ddf54 in main /code/tools/soll/main.cpp:34 #11 0x7f2705ad00b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) SUMMARY: AddressSanitizer: new-delete-type-mismatch (/lib/x86_64-linux-gnu/libasan.so.5+0x111bcd) in operator delete(void*, unsigned long, std::align_val_t) ==50310==HINT: if you don't care about these errors you may set ASAN_OPTIONS=new_delete_type_mismatch=0 ==50310==ABORTING