llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.85k stars 11.47k forks source link

bugpoint reduced testcase crashes lli (MCJIT) #29998

Closed llvmbot closed 7 years ago

llvmbot commented 7 years ago
Bugzilla Link 30650
Resolution WONTFIX
Resolved on Nov 17, 2016 16:27
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @lhames,@RKSimon,@rnk

Extended Description

While I was reducing #​30448, I hit this.

; ModuleID = 'reduced-bugpoint.ll' source_filename = "bugpoint-output-774e2d5.bc" target triple = "x86_64-unknown-linux-gnu"

@​d = local_unnamed_addr global i32 8, align 4 @​j = local_unnamed_addr global [1 x i64] [i64 6069905], align 8 @​a = common local_unnamed_addr global i32 0, align 4 @​c = common local_unnamed_addr global i32 0, align 4 @​e = common local_unnamed_addr global i32 0, align 4 @​f = common local_unnamed_addr global i32 0, align 4 @​g = common local_unnamed_addr global i32 0, align 4 @​h = external local_unnamed_addr global i32, align 4 @​n = common local_unnamed_addr global i32 0, align 4 @​o = common local_unnamed_addr global i32 0, align 4 @​p = common local_unnamed_addr global i32 0, align 4 @​b = common local_unnamed_addr global i64 0, align 8 @​r = external local_unnamed_addr global i64, align 8 @​i = common global i64 0, align 8

declare signext i8 @​fn1(i32, i32) local_unnamed_addr

define i32 @​main() local_unnamed_addr { entry: br label %for.cond4thread-pre-split.i

for.body12.i.us: ; preds = %for.inc7.i br label %for.cond19.preheader.i.preheader.us

for.cond19.preheader.i.preheader.us: ; preds = %for.body12.i.us br i1 undef, label %for.cond19.preheader.i.us.us.preheader, label %for.cond19.preheader.i.us1.preheader

for.cond19.preheader.i.us1.preheader: ; preds = %for.cond19.preheader.i.preheader.us unreachable

for.cond19.preheader.i.us.us.preheader: ; preds = %for.cond19.preheader.i.preheader.us ret i32 0

for.cond4thread-pre-split.i: ; preds = %entry br i1 false, label %for.inc7.i, label %for.inc.preheader.i

for.inc.preheader.i: ; preds = %for.cond4thread-pre-split.i unreachable

for.inc7.i: ; preds = %for.cond4thread-pre-split.i br label %for.body12.i.us }

$ gdb --args ~/work/llvm/build-gcc/bin/lli reduced-crash.ll GNU gdb (GDB) Fedora 7.11.1-75.fc24 Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /home/davide/work/llvm/build-gcc/bin/lli...done. (gdb) r Starting program: /home/davide/work/llvm/build-gcc/bin/lli reduced-crash.ll Missing separate debuginfos, use: dnf debuginfo-install glibc-2.23.1-10.fc24.x86_64 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7ff4000 in ?? () Missing separate debuginfos, use: dnf debuginfo-install libgcc-6.1.1-3.fc24.x86_64 libstdc++-6.1.1-3.fc24.x86_64 ncurses-libs-6.0-6.20160709.fc24.x86_64 zlib-1.2.8-10.fc24.x86_64 (gdb) bt

​0 0x00007ffff7ff4000 in ?? ()

​1 0x00000000012b6f65 in llvm::MCJIT::runFunction (this=0x2f7ccc0, F=0x2f792e8, ArgValues=...)

at ../lib/ExecutionEngine/MCJIT/MCJIT.cpp:569

​2 0x00000000012311a0 in llvm::ExecutionEngine::runFunctionAsMain (this=0x2f7ccc0, Fn=0x2f792e8,

argv=std::vector of length 1, capacity 1 = {...}, envp=0x7fffffffe160) at ../lib/ExecutionEngine/ExecutionEngine.cpp:471

​3 0x0000000000c52675 in main (argc=2, argv=0x7fffffffe148, envp=0x7fffffffe160) at ../tools/lli/lli.cpp:631

(gdb) f 1

​1 0x00000000012b6f65 in llvm::MCJIT::runFunction (this=0x2f7ccc0, F=0x2f792e8, ArgValues=...)

at ../lib/ExecutionEngine/MCJIT/MCJIT.cpp:569

569 rv.IntVal = APInt(BitWidth, ((int(*)())(intptr_t)FPtr)());

llvmbot commented 7 years ago

Hmm, I understand your point, but let me try to elaborate a bit.

I do think that any program passing the verifier shouldn't crash neither lli or llc, but error meaningfully. The main problem is that it's not really easy to understand if lli crashed because of a bug in lli or a bug in the JIT'ed executable (without looking at the code/the stacktrace).

That said, I don't think the cost of implementing a reliable solution is justified by the benefit. Hope it makes sense :)

rnk commented 7 years ago

I don't think it's expected that bugpoint reduced programs will be able to run without crashing.

llvmbot commented 7 years ago

https://reviews.llvm.org/D26809

llvmbot commented 7 years ago

Reduces to just: define i32 @​main() { unreachable }

llvmbot commented 7 years ago