https://llvm.org/bugs/show_bug.cgi?id=26971
Bug ID: 26971 Summary: crash at -O3 in 32-bit mode on x86_64-linux-gnu (Segmentation fault, llvm::Instruction::eraseFromParent()) Product: clang Version: trunk Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: -New Bugs Assignee: unassignedclangb...@nondot.org Reporter: chengnian...@gmail.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified The following code crashes the trunk at -O3 in 32-bit mode on x86_64-linux-gnu. $: clang-trunk -v clang version 3.9.0 (trunk 263641) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/local/bin Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.2 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0 Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Candidate multilib: x32;@mx32 Selected multilib: .;@m64 $: $: $: $: clang-trunk -c -w small.c -m32 -O3 0 clang-3.9 0x0000000001abe055 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37 1 clang-3.9 0x0000000001abbe06 llvm::sys::RunSignalHandlers() + 54 2 clang-3.9 0x0000000001abc031 3 libpthread.so.0 0x00007f31a8012340 4 clang-3.9 0x000000000174b156 llvm::Instruction::eraseFromParent() + 22 5 clang-3.9 0x0000000001afeefa llvm::RecursivelyDeleteTriviallyDeadInstructions(llvm::Value*, llvm::TargetLibraryInfo const*) + 538 6 clang-3.9 0x00000000019920ff 7 clang-3.9 0x00000000019940a6 8 clang-3.9 0x0000000001998133 9 clang-3.9 0x0000000002289287 llvm::LPPassManager::runOnFunction(llvm::Function&) + 1431 10 clang-3.9 0x0000000001777ab3 llvm::FPPassManager::runOnFunction(llvm::Function&) + 643 11 clang-3.9 0x000000000226b680 12 clang-3.9 0x000000000177817f llvm::legacy::PassManagerImpl::run(llvm::Module&) + 751 13 clang-3.9 0x0000000001be80a8 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, llvm::raw_pwrite_stream*) + 3144 14 clang-3.9 0x00000000021726ec 15 clang-3.9 0x000000000248b1eb clang::ParseAST(clang::Sema&, bool, bool) + 571 16 clang-3.9 0x000000000217287e clang::CodeGenAction::ExecuteAction() + 78 17 clang-3.9 0x0000000001ec5696 clang::FrontendAction::Execute() + 534 18 clang-3.9 0x0000000001ea1f5e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 318 19 clang-3.9 0x0000000001f4948c clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2300 20 clang-3.9 0x00000000009e2a98 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 2344 21 clang-3.9 0x000000000099e895 main + 6213 22 libc.so.6 0x00007f31a721bec5 __libc_start_main + 245 23 clang-3.9 0x00000000009dea44 Stack dump: 0. Program arguments: /usr/local/clang-trunk/bin/clang-3.9 -cc1 -triple i386-unknown-linux-gnu -emit-obj -disable-free -main-file-name small.c -mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu pentium4 -momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb -coverage-file /home/cnsun/temp/clang-m32/small.c -resource-dir /usr/local/clang-trunk/bin/../lib/clang/3.9.0 -c-isystem . -c-isystem /usr/local/include/csmith-2.2.0/ -internal-isystem /usr/local/include -internal-isystem /usr/local/clang-trunk/bin/../lib/clang/3.9.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -w -fdebug-compilation-dir /home/cnsun/temp/clang-m32 -ferror-limit 19 -fmessage-length 126 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o small.o -x c small.c 1. <eof> parser at end of file 2. Per-module optimization passes 3. Running pass 'CallGraph Pass Manager' on module 'small.c'. 4. Running pass 'Loop Pass Manager' on function '@write_frequencies_j' 5. Running pass 'Recognize loop idioms' on basic block '%if.then' clang-3.9: error: unable to execute command: Segmentation fault (core dumped) clang-3.9: error: clang frontend command failed due to signal (use -v to see invocation) clang version 3.9.0 (trunk 263641) Target: i386-unknown-linux-gnu Thread model: posix InstalledDir: /usr/local/bin clang-3.9: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script. clang-3.9: note: diagnostic msg: ******************** PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang-3.9: note: diagnostic msg: /home/cnsun/ramdisk/tmp/small-5f188f.c clang-3.9: note: diagnostic msg: /home/cnsun/ramdisk/tmp/small-5f188f.sh clang-3.9: note: diagnostic msg: ******************** $: $: $: clang-trunk -c -w small.c -m64 -O3 $: clang-trunk -c -w small.c -m32 -O1 $: $: cat small.c typedef struct { char *string; int num; } sorter; long a; void write_frequencies_j() { long b = 0; sorter *s; sorter c; s = calloc(0, sizeof(sorter)); for (; b < a; b++) if (s) { memcpy(&c, &s[b], sizeof(sorter)); memcpy(write_frequencies_j, &s, sizeof(sorter)); memcpy(&s[b], &c, sizeof(sorter)); } } $: -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs