[llvm-bugs] [Bug 34159] New: clang crashes on valid code at -O1 and above with debugging enabled: Assertion `FragmentOffset >= OffsetInBits && "overlapping or duplicate fragments"' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 11 08:21:16 PDT 2017


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

            Bug ID: 34159
           Summary: clang crashes on valid code at -O1 and above with
                    debugging enabled: Assertion `FragmentOffset >=
                    OffsetInBits && "overlapping or duplicate fragments"'
                    failed
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvm-bugs at lists.llvm.org

$ clang -v
clang version 6.0.0 (trunk 310694)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
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.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
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.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang -O1 small.c
$ ./a.out
$
$ clang -O1 -g small.c
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 0x000000000227809a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-6.0+0x227809a)
#1 0x000000000227622e llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-6.0+0x227622e)
#2 0x0000000002276390 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-6.0+0x2276390)
#3 0x00007f9139da2330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007f9138b8ac37 gsignal
/build/eglibc-SvCtMH/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f9138b8e028 abort
/build/eglibc-SvCtMH/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f9138b83bf6 __assert_fail_base
/build/eglibc-SvCtMH/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f9138b83ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x00000000028c20a1 (/usr/local/clang-trunk/bin/clang-6.0+0x28c20a1)
#9 0x0000000002906114
llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE(llvm::DIGlobalVariable
const*, llvm::ArrayRef<llvm::DwarfCompileUnit::GlobalExpr>)
(/usr/local/clang-trunk/bin/clang-6.0+0x2906114)
#10 0x00000000028bb9b8 llvm::DwarfDebug::beginModule()
(/usr/local/clang-trunk/bin/clang-6.0+0x28bb9b8)
#11 0x000000000289e89d llvm::AsmPrinter::doInitialization(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-6.0+0x289e89d)
#12 0x0000000001def857 llvm::FPPassManager::doInitialization(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-6.0+0x1def857)
#13 0x0000000001dfa80b llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-6.0+0x1dfa80b)
#14 0x000000000240f000 (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+0x240f000)
#15 0x00000000024103a2 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+0x24103a2)
#16 0x0000000002b24cdf
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-6.0+0x2b24cdf)
#17 0x0000000002f427ec clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-6.0+0x2f427ec)
#18 0x0000000002b24180 clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-6.0+0x2b24180)
#19 0x00000000027c2e8e clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-6.0+0x27c2e8e)
#20 0x0000000002796286
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-6.0+0x2796286)
#21 0x000000000285e7a2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-6.0+0x285e7a2)
#22 0x0000000000cac7e8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-6.0+0xcac7e8)
#23 0x0000000000c475d2 main (/usr/local/clang-trunk/bin/clang-6.0+0xc475d2)
#24 0x00007f9138b75f45 __libc_start_main
/build/eglibc-SvCtMH/eglibc-2.19/csu/libc-start.c:321:0
#25 0x0000000000ca81a9 _start (/usr/local/clang-trunk/bin/clang-6.0+0xca81a9)
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 -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 -O1
-fdebug-compilation-dir
/home/su/specres/20170810-clang-trunk-m64-O3-g-build-171928 -ferror-limit 19
-fmessage-length 116 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/small-be5761.o -x c small.c
1.      <eof> parser at end of file
2.      Code generation
clang-6.0: error: unable to execute command: Aborted (core dumped)
clang-6.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 6.0.0 (trunk 310694)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/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-f5faa4.c
clang-6.0: note: diagnostic msg: /tmp/small-f5faa4.sh
clang-6.0: note: diagnostic msg:

********************
$


-------------------------------------


struct A
{ 
  int b;
  int c;
  int d;
  int e;
  int f;
};

struct B
{ 
  struct A b;
  int h;
  int i;
  struct A f;
  int j;
};

static struct
{ 
  int c;
  struct B h;
  int e;
  int i;
  struct B f;
  int k;
} l;

int m;

void fn1 ()
{ 
  l.h.f.b ^= l.f.h += l.h.b.c += l.h.j -= l.h.f.f -= l.c &= l.f.f.d = m >
l.f.f.d;
  l.k = l.h.i--;
  l.f.b.f ^= l.i;
  if (l.k)
    l.e += l.f.f.f |= l.i = l.h.f.c += l.h.f.e &= l.f.f.b++;
}

int main ()
{ 
  fn1 ();
  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/20170811/7cc8c57b/attachment-0001.html>


More information about the llvm-bugs mailing list