<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - crash with "-g" at -O1 and above in 32-bit and 64-bit modes on x86_64-linux-gnu (Assertion `FragmentOffset >= OffsetInBits && "overlapping or duplicate fragments"' failed.)"
   href="https://bugs.llvm.org/show_bug.cgi?id=34435">34435</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>crash with "-g" at -O1 and above in 32-bit and 64-bit modes on x86_64-linux-gnu (Assertion `FragmentOffset >= OffsetInBits && "overlapping or duplicate fragments"' failed.)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>chengniansun@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ clang-trunk -v
clang version 6.0.0 (trunk 312414)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
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.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.2
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
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ clang-trunk -O3 -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 0x00000000021345ea llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-6.0+0x21345ea)
#1 0x000000000213269e llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-6.0+0x213269e)
#2 0x0000000002132802 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-6.0+0x2132802)
#3 0x00007f26657be330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007f26645acc37 gsignal
/build/eglibc-MjiXCM/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f26645b0028 abort
/build/eglibc-MjiXCM/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f26645a5bf6 __assert_fail_base
/build/eglibc-MjiXCM/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f26645a5ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x0000000002838c19 (/usr/local/clang-trunk/bin/clang-6.0+0x2838c19)
#9 0x0000000002878bd1
llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE(llvm::DIGlobalVariable
const*, llvm::ArrayRef<llvm::DwarfCompileUnit::GlobalExpr>)
(/usr/local/clang-trunk/bin/clang-6.0+0x2878bd1)
#10 0x00000000028325d8 llvm::DwarfDebug::beginModule()
(/usr/local/clang-trunk/bin/clang-6.0+0x28325d8)
#11 0x000000000281771a llvm::AsmPrinter::doInitialization(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-6.0+0x281771a)
#12 0x0000000001cdc767 llvm::FPPassManager::doInitialization(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-6.0+0x1cdc767)
#13 0x0000000001ce738b llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-6.0+0x1ce738b)
#14 0x00000000022be92e (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+0x22be92e)
#15 0x00000000022bfc0f 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+0x22bfc0f)
#16 0x0000000002a974ab
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-6.0+0x2a974ab)
#17 0x0000000002cb5412 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-6.0+0x2cb5412)
#18 0x0000000002a96b4f clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-6.0+0x2a96b4f)
#19 0x0000000002656636 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-6.0+0x2656636)
#20 0x000000000262dc0e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-6.0+0x262dc0e)
#21 0x00000000026e500b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-6.0+0x26e500b)
#22 0x0000000000c20cf8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-6.0+0xc20cf8)
#23 0x0000000000badeef main (/usr/local/clang-trunk/bin/clang-6.0+0xbadeef)
#24 0x00007f2664597f45 __libc_start_main
/build/eglibc-MjiXCM/eglibc-2.19/csu/libc-start.c:321:0
#25 0x0000000000c1c319 _start (/usr/local/clang-trunk/bin/clang-6.0+0xc1c319)
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-4/res/20170901-clang-trunk-m32-Weverything-g-O3-mllvm-enable-newgvn-mllvm-polly-build-145517/delta
-ferror-limit 19 -fmessage-length 270 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/small-e37dc0.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 312414)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-6.0: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> 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-a5424f.c
clang-6.0: note: diagnostic msg: /tmp/small-a5424f.sh
clang-6.0: note: diagnostic msg: 

********************
$ cat small.c
struct S0 {
  int f0;
  short f1;
};
struct {
  short f1;
  struct S0 f2;
  char f7;
} static a = {9, 2}, *b = &a;
int main() {
  a.f1++;
  char c = a.f7 & 5;
  a.f7 = c;
  for (; (*b).f2.f1; (*b).f2.f1++)
    (*b).f2.f0 = 0;
  for (; (*b).f2.f0;)
    ;
  return 0;
}
$</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>