[llvm-bugs] [Bug 34204] New: crash at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu (Assertion `FragmentOffset >= OffsetInBits && "overlapping or duplicate fragments"' failed.)

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 16 00:06:23 PDT 2017


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

            Bug ID: 34204
           Summary: crash at -O3 in both 32-bit and 64-bit modes on
                    x86_64-linux-gnu (Assertion `FragmentOffset >=
                    OffsetInBits && "overlapping or duplicate fragments"'
                    failed.)
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chengniansun at gmail.com
                CC: llvm-bugs at lists.llvm.org

$ clang-trunk -v
clang version 6.0.0 (trunk 310925) (llvm/trunk 310924)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.2
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.4
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
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ clang-trunk -g -O3 -mllvm -enable-newgvn small.c
small.c:32:8: warning: expression result unused [-Wunused-value]
  for (d; d; b.f8.f5++)
       ^
clang-6.0:
/tmp/llvm-builder/llvm-source-trunk/lib/CodeGen/AsmPrinter/DwarfExpression.cpp:405:
void llvm::DwarfExpression::addFragmentOffset(const llvm::DIExpression*):
Assertion `FragmentOffset >= OffsetInBits && "overlapping or duplicate
fragments"' failed.
#0 0x00000000021b4b9a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-6.0+0x21b4b9a)
#1 0x00000000021b2d5e llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-6.0+0x21b2d5e)
#2 0x00000000021b2ec0 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-6.0+0x21b2ec0)
#3 0x00007f0ac91148d0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0xf8d0)
#4 0x00007f0ac7d1c067 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x35067)
#5 0x00007f0ac7d1d448 abort (/lib/x86_64-linux-gnu/libc.so.6+0x36448)
#6 0x00007f0ac7d15266 (/lib/x86_64-linux-gnu/libc.so.6+0x2e266)
#7 0x00007f0ac7d15312 (/lib/x86_64-linux-gnu/libc.so.6+0x2e312)
#8 0x00000000027a383f
llvm::DwarfExpression::addFragmentOffset(llvm::DIExpression const*)
(/usr/local/clang-trunk/bin/clang-6.0+0x27a383f)
#9 0x00000000027e6384
llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE(llvm::DIGlobalVariable
const*, llvm::ArrayRef<llvm::DwarfCompileUnit::GlobalExpr>)
(/usr/local/clang-trunk/bin/clang-6.0+0x27e6384)
#10 0x000000000279e54c llvm::DwarfDebug::beginModule()
(/usr/local/clang-trunk/bin/clang-6.0+0x279e54c)
#11 0x000000000278259d llvm::AsmPrinter::doInitialization(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-6.0+0x278259d)
#12 0x0000000001d71297 llvm::FPPassManager::doInitialization(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-6.0+0x1d71297)
#13 0x0000000001d7b80b llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-6.0+0x1d7b80b)
#14 0x000000000232e4fa (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/local/clang-trunk/bin/clang-6.0+0x232e4fa)
#15 0x000000000232f865 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> >)
(/usr/local/clang-trunk/bin/clang-6.0+0x232f865)
#16 0x00000000029f52ec
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-6.0+0x29f52ec)
#17 0x0000000002dcd17c clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-6.0+0x2dcd17c)
#18 0x00000000029f47a0 clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-6.0+0x29f47a0)
#19 0x00000000026afd26 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-6.0+0x26afd26)
#20 0x0000000002683276
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-6.0+0x2683276)
#21 0x00000000027453d2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-6.0+0x27453d2)
#22 0x0000000000cd3e00 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-6.0+0xcd3e00)
#23 0x0000000000c6be85 main (/usr/local/clang-trunk/bin/clang-6.0+0xc6be85)
#24 0x00007f0ac7d08b45 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21b45)
#25 0x0000000000ccf919 _start (/usr/local/clang-trunk/bin/clang-6.0+0xccf919)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-6.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name small.c
-mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-momit-leaf-frame-pointer -dwarf-column-info -debug-info-kind=limited
-dwarf-version=4 -debugger-tuning=gdb -resource-dir
/usr/local/clang-trunk/lib/clang/6.0.0 -c-isystem
/usr/local/include/csmith-2.2.0 -c-isystem /usr/local/include/csmith-2.2.0
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang-trunk/lib/clang/6.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O3 -fdebug-compilation-dir
/home/cnsun/ramdisk/hermes/run-1/res/20170813-clang-trunk-m32-Weverything-g-O3-mllvm-enable-newgvn-build-091441/delta
-ferror-limit 19 -fmessage-length 261 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-mllvm -enable-newgvn -o /tmp/small-504563.o -x c small.c 
1.      <eof> parser at end of file
2.      Code generation
clang-6.0: error: unable to execute command: Aborted
clang-6.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 6.0.0 (trunk 310925) (llvm/trunk 310924)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-6.0: 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-6.0: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-6.0: note: diagnostic msg: /tmp/small-bb0c35.c
clang-6.0: note: diagnostic msg: /tmp/small-bb0c35.sh
clang-6.0: note: diagnostic msg: 

********************
$ cat small.c
struct S0 {
  int f1;
};
struct S1 {
  int f0;
  int f1;
  char f2;
  int f3;
  int f5;
  short f6;
  int f7;
  int f8;
};
struct S2 {
  int f1;
  struct S1 f3;
  int f4;
  short f6;
  struct S1 f8;
  struct S0 f9;
};
char a;
static struct S2 b;
int c, d, e;
void fn1() {
  b.f8.f8 = a;
  for (; b.f3.f3; b.f3.f3++)
    for (; b.f1; b.f9.f1++)
      if (b.f3.f7)
        b.f3.f2 |= b.f8.f2 = c;
  b.f4++;
  for (d; d; b.f8.f5++)
    ;
  b.f3.f0++;
  if (b.f8.f6)
    b.f6++;
}

void fn2() {
  if (b.f8.f2)
    b.f3.f8 &= --b.f3.f5;
}

int main() {
  for (; b.f1; b.f3.f1++)
    b.f1 = b.f3.f7 = b.f8.f8;
  b.f8.f7 |= b.f8.f6 = e;
  return 0;
}
$

-- 
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/20170816/5bfe21b9/attachment.html>


More information about the llvm-bugs mailing list