[llvm-bugs] [Bug 36238] New: llvm::insertDebugValuesForPHIs asserts with "Ill-formed basic block"

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 5 08:01:57 PST 2018


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

            Bug ID: 36238
           Summary: llvm::insertDebugValuesForPHIs asserts with
                    "Ill-formed basic block"
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: hans at chromium.org
                CC: llvm-bugs at lists.llvm.org

creduced test case:

long a();
class b {
public:
  ~b();
};
typedef struct { int c; } e;
typedef struct {
} d;
class f : public d {
public:
  f(int);
  b g;
};
void h(int *, int *, int, unsigned *, unsigned char **, size_t *, size_t *,
       size_t *, d *, d *);
long j(f, long, struct k *, int *);
int l;
long m() {
  e n;
  int db;
  d o;
  long p;
  unsigned char *q;
  unsigned r;
  size_t u;
  f s(l);
  for (int i;;) {
    size_t offset;
    size_t t;
    int status;
    __try {
      h(&db, &n.c, i, &r, &q, &u, &offset, &t, &s, &o);
    } __except (j(s, _exception_code(), (k *)_exception_info(), &status)) {
      p = 7;
    }
    if (p)
      break;
    p = a();
  }
  return p;
}

$ clang -cc1 -triple x86_64-pc-windows-msvc19.11.0 -emit-obj -munwind-tables
-target-cpu x86-64 -gcodeview -debug-info-kind=limited -debugger-tuning=gdb -Os
-fms-extensions -fms-compatibility -fms-compatibility-version=19.11 -std=c++14
-fseh-exceptions -x c++ a.ii

clang: ../lib/Transforms/Utils/Local.cpp:1377: void
llvm::insertDebugValuesForPHIs(llvm::BasicBlock*,
llvm::SmallVectorImpl<llvm::PHINode*>&): Assertion `InsertionPt !=
Parent->end() && "Ill-formed basic block"' failed.
#0 0x00005595e785319a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/work/llvm/build.release/bin/clang+0x241819a)
#1 0x00005595e785101e llvm::sys::RunSignalHandlers()
(/work/llvm/build.release/bin/clang+0x241601e)
#2 0x00005595e785116c SignalHandler(int)
(/work/llvm/build.release/bin/clang+0x241616c)
#3 0x00007f611676c0c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x110c0)
#4 0x00007f6115301fcf gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x32fcf)
#5 0x00007f61153033fa abort (/lib/x86_64-linux-gnu/libc.so.6+0x343fa)
#6 0x00007f61152fae37 (/lib/x86_64-linux-gnu/libc.so.6+0x2be37)
#7 0x00007f61152faee2 (/lib/x86_64-linux-gnu/libc.so.6+0x2bee2)
#8 0x00005595e78ca9dd llvm::insertDebugValuesForPHIs(llvm::BasicBlock*,
llvm::SmallVectorImpl<llvm::PHINode*>&)
(/work/llvm/build.release/bin/clang+0x248f9dd)
#9 0x00005595e78b3e69
llvm::formLCSSAForInstructions(llvm::SmallVectorImpl<llvm::Instruction*>&,
llvm::DominatorTree&, llvm::LoopInfo&)
(/work/llvm/build.release/bin/clang+0x2478e69)
#10 0x00005595e78b5e75 llvm::formLCSSA(llvm::Loop&, llvm::DominatorTree&,
llvm::LoopInfo*, llvm::ScalarEvolution*)
(/work/llvm/build.release/bin/clang+0x247ae75)
#11 0x00005595e78b716f llvm::formLCSSARecursively(llvm::Loop&,
llvm::DominatorTree&, llvm::LoopInfo*, llvm::ScalarEvolution*)
(/work/llvm/build.release/bin/clang+0x247c16f)
#12 0x00005595e78b7305 (anonymous
namespace)::LCSSAWrapperPass::runOnFunction(llvm::Function&)
(/work/llvm/build.release/bin/clang+0x247c305)
#13 0x00005595e7352193 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/work/llvm/build.release/bin/clang+0x1f17193)
#14 0x00005595e6dae9ab (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/work/llvm/build.release/bin/clang+0x19739ab)
#15 0x00005595e7352e71 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/work/llvm/build.release/bin/clang+0x1f17e71)
#16 0x00005595e7a1cdc1 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/work/llvm/build.release/bin/clang+0x25e1dc1)
#17 0x00005595e7a1e596 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/work/llvm/build.release/bin/clang+0x25e3596)
#18 0x00005595e8171f14
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/work/llvm/build.release/bin/clang+0x2d36f14)
#19 0x00005595e859ac88 clang::ParseAST(clang::Sema&, bool, bool)
(/work/llvm/build.release/bin/clang+0x315fc88)
#20 0x00005595e8171189 clang::CodeGenAction::ExecuteAction()
(/work/llvm/build.release/bin/clang+0x2d36189)
#21 0x00005595e7dffd3e clang::FrontendAction::Execute()
(/work/llvm/build.release/bin/clang+0x29c4d3e)
#22 0x00005595e7dcbe46
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/work/llvm/build.release/bin/clang+0x2990e46)
#23 0x00005595e7e982eb
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/work/llvm/build.release/bin/clang+0x2a5d2eb)
#24 0x00005595e60fe1e0 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/work/llvm/build.release/bin/clang+0xcc31e0)
#25 0x00005595e607f005 main (/work/llvm/build.release/bin/clang+0xc44005)
#26 0x00007f61152ef2b1 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x202b1)
#27 0x00005595e60fa1da _start (/work/llvm/build.release/bin/clang+0xcbf1da)

-- 
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/20180205/015109e0/attachment.html>


More information about the llvm-bugs mailing list