<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - clang crashes on x86_64-linux-gnu at O1 and above in 32-bit and 64-bit modes (Assertion `Offset <= PieceOffset && "overlapping or duplicate pieces"' failed)"
   href="https://llvm.org/bugs/show_bug.cgi?id=26148">26148</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crashes on x86_64-linux-gnu at O1 and above in 32-bit and 64-bit modes (Assertion `Offset <= PieceOffset && "overlapping or duplicate pieces"' failed)
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </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>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following code crashes clang trunk at -O1 and above in both 32-bit and
64-bit modes. 



$: clang-trunk -v
clang version 3.9.0 (trunk 257643)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/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.3
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.2.1
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.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.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.2.1
Found candidate GCC installation:
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3
Found candidate GCC installation:
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.4
Found candidate GCC installation:
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.2
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-trunk -O1 -g small.c
clang: /tmp/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1561: void
llvm::DebugLocEntry::finalize(const llvm::AsmPrinter &,
DebugLocStream::ListBuilder &, const llvm::DIBasicType *): Assertion `Offset <=
PieceOffset && "overlapping or duplicate pieces"' failed.
0  clang           0x0000000003095008
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  clang           0x0000000003095777
2  libpthread.so.0 0x00007f7473224340
3  libc.so.6       0x00007f747222ecc9 gsignal + 57
4  libc.so.6       0x00007f74722320d8 abort + 328
5  libc.so.6       0x00007f7472227b86
6  libc.so.6       0x00007f7472227c32
7  clang           0x000000000265c65a
llvm::DebugLocEntry::finalize(llvm::AsmPrinter const&,
llvm::DebugLocStream::ListBuilder&, llvm::DIBasicType const*) + 906
8  clang           0x000000000265bde7
llvm::DwarfDebug::collectVariableInfo(llvm::DwarfCompileUnit&,
llvm::DISubprogram const*, llvm::DenseSet<std::pair<llvm::DILocalVariable
const*, llvm::DILocation const*>,
llvm::DenseMapInfo<std::pair<llvm::DILocalVariable const*, llvm::DILocation
const*> > >&) + 1063
9  clang           0x000000000265dd90
llvm::DwarfDebug::endFunction(llvm::MachineFunction const*) + 352
10 clang           0x000000000263e231 llvm::AsmPrinter::EmitFunctionBody() +
7025
11 clang           0x0000000002318b98
12 clang           0x000000000273e089
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 153
13 clang           0x0000000002fd90d4
llvm::FPPassManager::runOnFunction(llvm::Function&) + 564
14 clang           0x0000000002fd931b
llvm::FPPassManager::runOnModule(llvm::Module&) + 43
15 clang           0x0000000002fd97e5
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 869
16 clang           0x0000000000a168dd
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_pwrite_stream*)
+ 9693
17 clang           0x00000000009f6f38
18 clang           0x0000000000cab776 clang::ParseAST(clang::Sema&, bool, bool)
+ 582
19 clang           0x0000000000789d35 clang::FrontendAction::Execute() + 69
20 clang           0x0000000000752d91
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1153
21 clang           0x00000000007318dc
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3068
22 clang           0x00000000007277a8 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 1176
23 clang           0x000000000072ff93 main + 12707
24 libc.so.6       0x00007f7472219ec5 __libc_start_main + 245
25 clang           0x0000000000727234
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang -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
-target-linker-version 2.24 -momit-leaf-frame-pointer -dwarf-column-info
-debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/3.9.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.9.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O1 -fdebug-compilation-dir
/data2/c-hunter-results/C/instrument-bugs/REDUCED/20160114-clang-trunk-m64-g-O3-build-051234/delta
-ferror-limit 19 -fmessage-length 238 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/small-ee55a9.o -x c
small.c 
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'small.c'.
4.      Running pass 'X86 Assembly / Object Emitter' on function '@fn1'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 257643)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang: 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: note: diagnostic msg: 
********************

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

********************
$: 
$: cat small.c
struct S0 {
  int f0;
  short f5;
} b;
static int a;
void fn1(char p1) {
  struct S0 c = {3};
  if (a)
    b = c;
  c.f0 = p1;
}

int main() { 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>