Open theworld3 opened 1 year ago
Weird, I managed to compile your example localy. I will look into it later this week.
@xlauko I'm sorry to bother you again. May I know if you encountered the same problem while executed vast-cc --ccopts -xc --from-source r1.c
?
Yep, I managed to reproduce it, working on it at the moment :)
@xlauko Hello, thank you very much for submitting a new version of Vast for this issue yesterday. When I use the latest vast-cc
today and executed vast-cc --ccopts -xc --from-source r1.c
. As a result, the previous error message was encountered:
In file included from input.cc:4:
In file included from ./csmith.h:45:
In file included from ./random_inc.h:100:
./safe_math.h:1201:36: warning: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Wimplicit-const-int-float-conversion]
((sf1 <= INT32_MIN) || (sf1 >= INT32_MAX)) ?
~~ ^~~~~~~~~
/usr/include/stdint.h:123:22: note: expanded from macro 'INT32_MAX'
# define INT32_MAX (2147483647)
^~~~~~~~~~
unknown:1:1: error: redefinition of symbol named 'fscanf'
unknown:1:1: note: see current operation: "hl.func"() ({
}) {function_type = (!hl.lvalue<!hl.ptr<!hl.typedef<"FILE">, restrict >>, !hl.lvalue<!hl.ptr<!hl.char< const >, restrict >>) -> !hl.int, linkage = 0 : i32, sym_name = "fscanf", sym_visibility = "private"} : () -> ()
/usr/include/stdio.h:415:12: note: see existing symbol definition here
extern int fscanf (FILE *__restrict __stream,
Could you take a look at this question again?
It is probably too experimental, but can you try vast-front r1.c -vast-emit-high-level -o -
.
It is supposed to be new frontend alternative, that you can replace for compiler in the build system.
@xlauko Thank you for your reply, when I executed vast-front r1.c -vast-emit-high-level -o -
. It turned out to be:
In file included from r1.c:4:
In file included from ./csmith.h:45:
In file included from ./random_inc.h:100:
./safe_math.h:1201:36: warning: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Wimplicit-const-int-float-conversion]
((sf1 <= INT32_MIN) || (sf1 >= INT32_MAX)) ?
~~ ^~~~~~~~~
/usr/include/stdint.h:123:22: note: expanded from macro 'INT32_MAX'
# define INT32_MAX (2147483647)
^~~~~~~~~~
PLEASE submit a bug report to https://github.com/trailofbits/vast/issues and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: vast-front r1.c -vast-emit-high-level -o -
1. <eof> parser at end of file
2. r1.c:21:5: LLVM IR generation of declaration 'main'
#0 0x00007f7c6dff53b1 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-15/lib/libLLVM-15.so.1+0xf043b1)
#1 0x00007f7c6dff30fe llvm::sys::RunSignalHandlers() (/usr/lib/llvm-15/lib/libLLVM-15.so.1+0xf020fe)
#2 0x00007f7c6dff4771 llvm::sys::CleanupOnSignal(unsigned long) (/usr/lib/llvm-15/lib/libLLVM-15.so.1+0xf03771)
#3 0x00007f7c6df1867f (/usr/lib/llvm-15/lib/libLLVM-15.so.1+0xe2767f)
#4 0x00007f7c6cb85520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#5 0x000055d45a065e23 mlir::Value::getDefiningOp() const (/data/vast/builds/ninja-multi-default/tools/vast-front/Release/vast-front+0x1288e23)
#6 0x000055d45b0c7247 vast::cg::CodeGenStmtVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >::VisitFileVarDeclRefExpr(clang::DeclRefExpr const*) CodeGenDriver.cpp:0:0
#7 0x000055d45b0b72df vast::cg::CodeGenFallBackVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator>, vast::cg::DefaultCodeGenVisitorMixin, vast::cg::DefaultFallBackVisitorMixin>::Visit(clang::Stmt const*) CodeGenDriver.cpp:0:0
#8 0x000055d45b0c69ac mlir::Operation* vast::cg::CodeGenStmtVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >::VisitCast<vast::hl::ImplicitCastOp>(clang::CastExpr const*) CodeGenDriver.cpp:0:0
#9 0x000055d45b0b72df vast::cg::CodeGenFallBackVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator>, vast::cg::DefaultCodeGenVisitorMixin, vast::cg::DefaultFallBackVisitorMixin>::Visit(clang::Stmt const*) CodeGenDriver.cpp:0:0
#10 0x000055d45b0b86db vast::cg::CodeGenStmtVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >::VisitArraySubscriptExpr(clang::ArraySubscriptExpr const*) CodeGenDriver.cpp:0:0
#11 0x000055d45b0b72df vast::cg::CodeGenFallBackVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator>, vast::cg::DefaultCodeGenVisitorMixin, vast::cg::DefaultFallBackVisitorMixin>::Visit(clang::Stmt const*) CodeGenDriver.cpp:0:0
#12 0x000055d45b0be088 mlir::Operation* vast::cg::CodeGenStmtVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >::VisitAssignBinOp<vast::hl::AssignOp>(clang::BinaryOperator const*) CodeGenDriver.cpp:0:0
#13 0x000055d45b0b72df vast::cg::CodeGenFallBackVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator>, vast::cg::DefaultCodeGenVisitorMixin, vast::cg::DefaultFallBackVisitorMixin>::Visit(clang::Stmt const*) CodeGenDriver.cpp:0:0
#14 0x000055d45b0b7b1d vast::cg::CodeGenStmtVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >::VisitCompoundStmt(clang::CompoundStmt const*) CodeGenDriver.cpp:0:0
#15 0x000055d45b0b72df vast::cg::CodeGenFallBackVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator>, vast::cg::DefaultCodeGenVisitorMixin, vast::cg::DefaultFallBackVisitorMixin>::Visit(clang::Stmt const*) CodeGenDriver.cpp:0:0
#16 0x000055d45b0c2d45 void llvm::function_ref<void (mlir::OpBuilder&, mlir::Location)>::callback_fn<vast::cg::CodeGenBuilderMixin<vast::cg::CodeGenStmtVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >, vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >::make_region_builder(clang::Stmt const*)::'lambda'(auto&, auto)>(long, mlir::OpBuilder&, mlir::Location) CodeGenDriver.cpp:0:0
#17 0x000055d45bf1e38d vast::build_region(mlir::OpBuilder&, mlir::OperationState&, std::optional<llvm::function_ref<void (mlir::OpBuilder&, mlir::Location)> >) (/data/vast/builds/ninja-multi-default/tools/vast-front/Release/vast-front+0x314138d)
#18 0x000055d45a014610 vast::hl::ForOp::build(mlir::OpBuilder&, mlir::OperationState&, std::optional<llvm::function_ref<void (mlir::OpBuilder&, mlir::Location)> >, std::optional<llvm::function_ref<void (mlir::OpBuilder&, mlir::Location)> >, std::optional<llvm::function_ref<void (mlir::OpBuilder&, mlir::Location)> >) (/data/vast/builds/ninja-multi-default/tools/vast-front/Release/vast-front+0x1237610)
#19 0x000055d45b0c3314 auto mlir::OpBuilder::create<vast::hl::ForOp, auto vast::cg::CodeGenBuilderMixin<vast::cg::CodeGenStmtVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >, vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >::make_stmt_builder<vast::hl::CondYieldOp>(clang::Stmt const*)::'lambda'(auto&, auto), vast::cg::CodeGenBuilderMixin<vast::cg::CodeGenStmtVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >, vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >::make_region_builder(clang::Stmt const*)::'lambda'(auto&, auto)&, vast::cg::CodeGenBuilderMixin<vast::cg::CodeGenStmtVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >, vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >::make_region_builder(clang::Stmt const*)::'lambda'(auto&, auto)&>(mlir::Location, auto vast::cg::CodeGenBuilderMixin<vast::cg::CodeGenStmtVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >, vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >::make_stmt_builder<vast::hl::CondYieldOp>(clang::Stmt const*)::'lambda'(auto&, auto)&&, vast::cg::CodeGenBuilderMixin<vast::cg::CodeGenStmtVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >, vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >::make_region_builder(clang::Stmt const*)::'lambda'(auto&, auto)&, vast::cg::CodeGenBuilderMixin<vast::cg::CodeGenStmtVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >, vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >::make_region_builder(clang::Stmt const*)::'lambda'(auto&, auto)&) CodeGenDriver.cpp:0:0
#20 0x000055d45b0b7de7 vast::cg::CodeGenStmtVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >::VisitForStmt(clang::ForStmt const*) CodeGenDriver.cpp:0:0
#21 0x000055d45b0b72df vast::cg::CodeGenFallBackVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator>, vast::cg::DefaultCodeGenVisitorMixin, vast::cg::DefaultFallBackVisitorMixin>::Visit(clang::Stmt const*) CodeGenDriver.cpp:0:0
#22 0x000055d45b0b7b1d vast::cg::CodeGenStmtVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >::VisitCompoundStmt(clang::CompoundStmt const*) CodeGenDriver.cpp:0:0
#23 0x000055d45b0b6497 auto vast::cg::CodeGenDeclVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >::VisitFunctionDecl(clang::FunctionDecl const*)::'lambda1'(auto)::operator()<vast::hl::FuncOp>(auto) const CodeGenDriver.cpp:0:0
#24 0x000055d45b0af948 vast::cg::CodeGenDeclVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >::VisitFunctionDecl(clang::FunctionDecl const*) CodeGenDriver.cpp:0:0
#25 0x000055d45b0aef8f vast::cg::CodeGenFallBackVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator>, vast::cg::DefaultCodeGenVisitorMixin, vast::cg::DefaultFallBackVisitorMixin>::Visit(clang::Decl const*) CodeGenDriver.cpp:0:0
#26 0x000055d45b0c5dc4 vast::cg::CodeGenStmtVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >::VisitDirectCallee(clang::FunctionDecl const*) CodeGenDriver.cpp:0:0
#27 0x000055d45b0c5944 vast::cg::CodeGenStmtVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >::VisitDirectCall(clang::CallExpr const*) CodeGenDriver.cpp:0:0
#28 0x000055d45b0b72df vast::cg::CodeGenFallBackVisitorMixin<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator>, vast::cg::DefaultCodeGenVisitorMixin, vast::cg::DefaultFallBackVisitorMixin>::Visit(clang::Stmt const*) CodeGenDriver.cpp:0:0
#29 0x000055d45b0db20f vast::cg::CodeGenBase<vast::cg::CodeGenVisitor<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator> >::emit_function_prologue(vast::hl::FuncOp, clang::GlobalDecl, vast::cg::function_info_t const&, vast::cg::function_arg_list, vast::cg::codegen_options const&) CodeGenFunction.cpp:0:0
#30 0x000055d45b0da8e1 vast::cg::DefaultCodeGen<vast::cg::DefaultCodeGenVisitorConfig, vast::cg::IDMetaGenerator>::emit_function_prologue(vast::hl::FuncOp, clang::GlobalDecl, vast::cg::function_info_t const&, vast::cg::function_arg_list, vast::cg::codegen_options const&) CodeGenFunction.cpp:0:0
#31 0x000055d45b0da69d vast::cg::codegen_driver::build_function_body(vast::hl::FuncOp, clang::GlobalDecl, vast::cg::function_info_t const&) (/data/vast/builds/ninja-multi-default/tools/vast-front/Release/vast-front+0x22fd69d)
#32 0x000055d45b0add65 vast::cg::codegen_driver::build_global_function_definition(clang::GlobalDecl) (/data/vast/builds/ninja-multi-default/tools/vast-front/Release/vast-front+0x22d0d65)
#33 0x000055d45b0ad4af vast::cg::codegen_driver::build_global(clang::GlobalDecl) (/data/vast/builds/ninja-multi-default/tools/vast-front/Release/vast-front+0x22d04af)
#34 0x000055d45b0acf02 vast::cg::codegen_driver::handle_top_level_decl(clang::Decl*) (/data/vast/builds/ninja-multi-default/tools/vast-front/Release/vast-front+0x22cff02)
#35 0x000055d45b0ad13b vast::cg::codegen_driver::handle_top_level_decl(clang::DeclGroupRef) (/data/vast/builds/ninja-multi-default/tools/vast-front/Release/vast-front+0x22d013b)
#36 0x000055d45b0a822b vast::cg::vast_generator::HandleTopLevelDecl(clang::DeclGroupRef) (/data/vast/builds/ninja-multi-default/tools/vast-front/Release/vast-front+0x22cb22b)
#37 0x000055d45b0a4064 vast::cc::vast_gen_consumer::HandleTopLevelDecl(clang::DeclGroupRef) GenAction.cpp:0:0
#38 0x000055d45a476d79 clang::ParseAST(clang::Sema&, bool, bool) (/data/vast/builds/ninja-multi-default/tools/vast-front/Release/vast-front+0x1699d79)
#39 0x000055d45a253177 clang::FrontendAction::Execute() (/data/vast/builds/ninja-multi-default/tools/vast-front/Release/vast-front+0x1476177)
#40 0x000055d459c94f26 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/data/vast/builds/ninja-multi-default/tools/vast-front/Release/vast-front+0xeb7f26)
#41 0x000055d45a46c648 vast::cc::execute_compiler_invocation(clang::CompilerInstance*, vast::cc::vast_args const&) (/data/vast/builds/ninja-multi-default/tools/vast-front/Release/vast-front+0x168f648)
#42 0x000055d459c8d0b1 vast::cc::cc1(vast::cc::vast_args const&, llvm::ArrayRef<char const*>, char const*, void*) (/data/vast/builds/ninja-multi-default/tools/vast-front/Release/vast-front+0xeb00b1)
#43 0x000055d459c89fbe execute_cc1_tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#44 0x000055d45ae76282 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const::$_1>(long) RewriteObjCFoundationAPI.cpp:0:0
#45 0x00007f7c6df183de llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/lib/llvm-15/lib/libLLVM-15.so.1+0xe273de)
#46 0x000055d45ae75d48 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const (/data/vast/builds/ninja-multi-default/tools/vast-front/Release/vast-front+0x2098d48)
#47 0x000055d45ae3719a clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/data/vast/builds/ninja-multi-default/tools/vast-front/Release/vast-front+0x205a19a)
#48 0x000055d45ae373ee clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&, bool) const (/data/vast/builds/ninja-multi-default/tools/vast-front/Release/vast-front+0x205a3ee)
#49 0x000055d45ae5297f clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/data/vast/builds/ninja-multi-default/tools/vast-front/Release/vast-front+0x207597f)
#50 0x000055d459c8a56b vast::cc::driver::execute() driver.cpp:0:0
#51 0x000055d459c89a73 main (/data/vast/builds/ninja-multi-default/tools/vast-front/Release/vast-front+0xeaca73)
#52 0x00007f7c6cb6cd90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#53 0x00007f7c6cb6ce40 call_init ./csu/../csu/libc-start.c:128:20
#54 0x00007f7c6cb6ce40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#55 0x000055d459c88ec5 _start (/data/vast/builds/ninja-multi-default/tools/vast-front/Release/vast-front+0xeabec5)
vast-front: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Ubuntu clang version 15.0.7
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /data/vast/builds/ninja-multi-default/tools/vast-front/Release
vast-front: error: unable to execute command: Segmentation fault (core dumped)
vast-front: note: diagnostic msg: Error generating preprocessed source(s).
May I know any way to solve this problem?
Thank you very much for making changes to the code for
csmith
. I used the latestvast-cc
and executedvast-cc --ccopts -xc --from-source r1.c
. (r1.c
contains the header file ofcsmith
).r1.c:
And it returned with :
However, I can compile r1.c with gcc correctly. Could anyone know what should I do next?