[llvm-bugs] [Bug 28783] New: A cast<> failed in ExtractLoops()

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jul 30 14:43:04 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28783

            Bug ID: 28783
           Summary: A cast<> failed in ExtractLoops()
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: bugpoint
          Assignee: unassignedbugs at nondot.org
          Reporter: feishenniubi at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16845
  --> https://llvm.org/bugs/attachment.cgi?id=16845&action=edit
The input .ll file that triggered the bug

I tried to use bugpoint to help me pinpoint a miscompilation bug in loop
optimizers, yet bugpoint itself crashes when trying to extract loops from the
miscompiled function.

The source of the error can be narrowed down to the ExtractLoops() function
inside Miscompilation.cpp. Around line 339 there's a statement
"MiscompiledFunctions[i] = cast<Function>(VMap[MiscompiledFunctions[i]]);". The
right-hand-side of this statement, i.e. VMap[...], turns out to be an empty
WeakVH rather than a Function*. 

This is how I invoked bugpoint: 
> bugpoint -run-llc -safe-run-llc test.ll -loop-unroll -gcc=clang++

This is what I got back from the invocation:

Read input file      : 'test.ll'
*** All input ok
Running selected passes on program to test for crash: Success!
Initializing execution environment: Found llc:
/home/grieve/LLVM/GSoC/Testing/debugBuild/bin/llc
Running the code generator to test for a crash: <llc>
Generating reference output from raw program: <llc><llc><CC><program>
Reference output is: bugpoint.reference.out-17cf006

*** Checking the code generator...
<llc><CC><program>
*** Output matches: Debugging miscompilation!
Checking to see if '' compiles correctly: <llc><CC><program> yup.
Checking to see if '-loop-unroll' compiles correctly: <llc><CC><program> nope.

*** Found miscompiling pass: -loop-unroll
Emitted bitcode to 'bugpoint-passinput.bc'

*** You can reproduce the problem with: opt bugpoint-passinput.bc -loop-unroll
Checking to see if the program is misoptimized when these functions are run
through the pass: main _ZNSt5dequeIdSaIdEE18_M_fill_initializeERKd
_ZNSt11_Deque_baseIdSaIdEE17_M_initialize_mapEm
_ZNSt11_Deque_baseIdSaIdEE15_M_create_nodesEPPdS3_ __clang_call_terminate
  Optimizing functions being tested: done.
  Checking to see if the merged program executes correctly: <llc><CC><program>
nope.
Checking to see if the program is misoptimized when these functions are run
through the pass: _ZNSt11_Deque_baseIdSaIdEE17_M_initialize_mapEm
_ZNSt11_Deque_baseIdSaIdEE15_M_create_nodesEPPdS3_ __clang_call_terminate
  Optimizing functions being tested: done.
  Checking to see if the merged program executes correctly: <llc><CC><program>
yup.
Checking to see if the program is misoptimized when these functions are run
through the pass: main _ZNSt5dequeIdSaIdEE18_M_fill_initializeERKd
  Optimizing functions being tested: done.
  Checking to see if the merged program executes correctly: <llc><CC><program>
nope.
Checking to see if the program is misoptimized when this function is run
through the pass: _ZNSt5dequeIdSaIdEE18_M_fill_initializeERKd
  Optimizing functions being tested: done.
  Checking to see if the merged program executes correctly: <llc><CC><program>
yup.
Checking to see if the program is misoptimized when this function is run
through the pass: main
  Optimizing functions being tested: done.
  Checking to see if the merged program executes correctly: <llc><CC><program>
nope.

*** The following function is being miscompiled:  main
Extracted a loop from the breaking portion of the program.
<llc><CC><program>bugpoint:
/home/grieve/LLVM/GSoC/Testing/llvm/include/llvm/Support/Casting.h:81: static
bool llvm::isa_impl_cl<To, From*>::doit(const From*) [with To = llvm::Function;
>From = llvm::Value]: Assertion `Val && "isa<> used on a null pointer"' failed.
#0 0x00007f55eba74f38 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/grieve/LLVM/GSoC/Testing/llvm/lib/Support/Unix/Signals.inc:402:0
#1 0x00007f55eba75298 PrintStackTraceSignalHandler(void*)
/home/grieve/LLVM/GSoC/Testing/llvm/lib/Support/Unix/Signals.inc:470:0
#2 0x00007f55eba73548 llvm::sys::RunSignalHandlers()
/home/grieve/LLVM/GSoC/Testing/llvm/lib/Support/Signals.cpp:44:0
#3 0x00007f55eba74896 SignalHandler(int)
/home/grieve/LLVM/GSoC/Testing/llvm/lib/Support/Unix/Signals.inc:256:0
#4 0x00007f55ea594cb0 (/lib/x86_64-linux-gnu/libc.so.6+0x36cb0)
#5 0x00007f55ea594c37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#6 0x00007f55ea598028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#7 0x00007f55ea58dbf6 __assert_fail_base
/build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#8 0x00007f55ea58dca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#9 0x0000000000483bc4 (bugpoint+0x483bc4)
#10 0x000000000047fd31 (bugpoint+0x47fd31)
#11 0x000000000047bc43 (bugpoint+0x47bc43)
#12 0x0000000000476bd0 (bugpoint+0x476bd0)
#13 0x000000000046fbcc (bugpoint+0x46fbcc)
#14 0x000000000049ca8d (bugpoint+0x49ca8d)
#15 0x000000000049e540 (bugpoint+0x49e540)
#16 0x000000000049eca3 (bugpoint+0x49eca3)
#17 0x0000000000463318 (bugpoint+0x463318)
#18 0x00000000004b1d61 (bugpoint+0x4b1d61)
#19 0x00007f55ea57ff45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#20 0x0000000000462529 (bugpoint+0x462529)
Stack dump:
0.    Program arguments: bugpoint -run-llc -safe-run-llc test.ll -loop-unroll
-gcc=clang++

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160730/068951bf/attachment.html>


More information about the llvm-bugs mailing list