<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 - ICE when compiling with -O2 -g"
   href="https://bugs.llvm.org/show_bug.cgi?id=52333">52333</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ICE when compiling with -O2 -g
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>tlwang@uwaterloo.ca
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>cnsun@uwaterloo.ca, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>See below

$ clang-trunk -v
clang version 14.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
91434d44699642075378c888bf61715ff2d9e23f)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/cnsun/usr/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ cat formatted_program-e3ce1c.c
#pragma pack(1)
struct a {
  signed b : 25;
  unsigned : 19;
  signed : 28
};
c;
d() {
  int e = 0;
  for (;;) {
    for (; c;)
      ;
    for (; e <= 0; e++) {
      struct a f[6][1] = {81298, 27563224};
      c &= 4;
      f[5][0].b = e;
    }
  }
}
main() {}
$
$ clang-trunk -O2 -g formatted_program-e3ce1c.c
formatted_program-e3ce1c.c:5:14: warning: expected ';' at end of declaration
list
  signed : 28
             ^
             ;
formatted_program-e3ce1c.c:7:1: warning: type specifier missing, defaults to
'int' [-Wimplicit-int]
c;
^
formatted_program-e3ce1c.c:8:1: warning: type specifier missing, defaults to
'int' [-Wimplicit-int]
d() {
^
formatted_program-e3ce1c.c:14:34: warning: implicit truncation from 'int' to
bit-field changes value from 27563224 to -5991208
[-Wbitfield-constant-conversion]
      struct a f[6][1] = {81298, 27563224};
                                 ^~~~~~~~
formatted_program-e3ce1c.c:20:1: warning: type specifier missing, defaults to
'int' [-Wimplicit-int]
main() {}
^
clang-14:
/tmp/tmp.X2xbVSfcay-clang-builder/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp:509:
void llvm::DwarfExpression::addExpression(llvm::DIExpressionCursor&&,
llvm::function_ref<bool(unsigned int, llvm::DIExpressionCursor&)>): Assertion
`SizeInBits >= OffsetInBits - FragmentOffset && "size underflow"' failed.
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /scratch/software/clang-trunk/bin/clang-14 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj --mrelax-relocations -disable-free
-clear-ast-before-backend -main-file-name formatted_program-e3ce1c.c
-mrelocation-model static -mframe-pointer=none -fmath-errno -fno-rounding-math
-mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic
-debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb
-fcoverage-compilation-dir=/home/tlwang/clang_crashes/crash1 -resource-dir
/scratch/software/clang-trunk/lib/clang/14.0.0 -internal-isystem
/scratch/software/clang-trunk/lib/clang/14.0.0/include -internal-isystem
/usr/local/include -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O2
-fdebug-compilation-dir=/home/tlwang/clang_crashes/crash1 -ferror-limit 19
-fgnuc-version=4.2.1 -fcolor-diagnostics -vectorize-loops -vectorize-slp
-faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o
/tmp/formatted_program-e3ce1c-799385.o -x c formatted_program-e3ce1c.c
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module
'formatted_program-e3ce1c.c'.
4.      Running pass 'X86 Assembly Printer' on function '@d'
 #0 0x000055ec3e3ebdb4 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x000055ec3e3e94ce SignalHandler(int) Signals.cpp:0:0
 #2 0x00007faac66633c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #3 0x00007faac610218b raise
/build/glibc-eX1tMB/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #4 0x00007faac60e1859 abort /build/glibc-eX1tMB/glibc-2.31/stdlib/abort.c:81:7
 #5 0x00007faac60e1729 get_sysdep_segment_value
/build/glibc-eX1tMB/glibc-2.31/intl/loadmsgcat.c:509:8
 #6 0x00007faac60e1729 _nl_load_domain
/build/glibc-eX1tMB/glibc-2.31/intl/loadmsgcat.c:970:34
 #7 0x00007faac60f2f36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
 #8 0x000055ec3f2080b0
llvm::DwarfExpression::addExpression(llvm::DIExpressionCursor&&,
llvm::function_ref<bool (unsigned int, llvm::DIExpressionCursor&)>)
(/scratch/software/clang-trunk/bin/clang-14+0x48440b0)
 #9 0x000055ec3f267b6b
llvm::DwarfCompileUnit::constructVariableDIEImpl(llvm::DbgVariable const&,
bool) (/scratch/software/clang-trunk/bin/clang-14+0x48a3b6b)
#10 0x000055ec3f268617
llvm::DwarfCompileUnit::constructVariableDIE(llvm::DbgVariable&,
llvm::LexicalScope const&, llvm::DIE*&)
(/scratch/software/clang-trunk/bin/clang-14+0x48a4617)
#11 0x000055ec3f26f9a9
llvm::DwarfCompileUnit::createScopeChildrenDIE(llvm::LexicalScope*,
llvm::SmallVectorImpl<llvm::DIE*>&, bool*)
(/scratch/software/clang-trunk/bin/clang-14+0x48ab9a9)
#12 0x000055ec3f271aa8
llvm::DwarfCompileUnit::constructScopeDIE(llvm::LexicalScope*,
llvm::SmallVectorImpl<llvm::DIE*>&)
(/scratch/software/clang-trunk/bin/clang-14+0x48adaa8)
#13 0x000055ec3f26fbc3
llvm::DwarfCompileUnit::createScopeChildrenDIE(llvm::LexicalScope*,
llvm::SmallVectorImpl<llvm::DIE*>&, bool*)
(/scratch/software/clang-trunk/bin/clang-14+0x48abbc3)
#14 0x000055ec3f271aa8
llvm::DwarfCompileUnit::constructScopeDIE(llvm::LexicalScope*,
llvm::SmallVectorImpl<llvm::DIE*>&)
(/scratch/software/clang-trunk/bin/clang-14+0x48adaa8)
#15 0x000055ec3f26fbc3
llvm::DwarfCompileUnit::createScopeChildrenDIE(llvm::LexicalScope*,
llvm::SmallVectorImpl<llvm::DIE*>&, bool*)
(/scratch/software/clang-trunk/bin/clang-14+0x48abbc3)
#16 0x000055ec3f271aa8
llvm::DwarfCompileUnit::constructScopeDIE(llvm::LexicalScope*,
llvm::SmallVectorImpl<llvm::DIE*>&)
(/scratch/software/clang-trunk/bin/clang-14+0x48adaa8)
#17 0x000055ec3f26fbc3
llvm::DwarfCompileUnit::createScopeChildrenDIE(llvm::LexicalScope*,
llvm::SmallVectorImpl<llvm::DIE*>&, bool*)
(/scratch/software/clang-trunk/bin/clang-14+0x48abbc3)
#18 0x000055ec3f271aa8
llvm::DwarfCompileUnit::constructScopeDIE(llvm::LexicalScope*,
llvm::SmallVectorImpl<llvm::DIE*>&)
(/scratch/software/clang-trunk/bin/clang-14+0x48adaa8)
#19 0x000055ec3f26fbc3
llvm::DwarfCompileUnit::createScopeChildrenDIE(llvm::LexicalScope*,
llvm::SmallVectorImpl<llvm::DIE*>&, bool*)
(/scratch/software/clang-trunk/bin/clang-14+0x48abbc3)
#20 0x000055ec3f271aa8
llvm::DwarfCompileUnit::constructScopeDIE(llvm::LexicalScope*,
llvm::SmallVectorImpl<llvm::DIE*>&)
(/scratch/software/clang-trunk/bin/clang-14+0x48adaa8)
#21 0x000055ec3f26fbc3
llvm::DwarfCompileUnit::createScopeChildrenDIE(llvm::LexicalScope*,
llvm::SmallVectorImpl<llvm::DIE*>&, bool*)
(/scratch/software/clang-trunk/bin/clang-14+0x48abbc3)
#22 0x000055ec3f271aa8
llvm::DwarfCompileUnit::constructScopeDIE(llvm::LexicalScope*,
llvm::SmallVectorImpl<llvm::DIE*>&)
(/scratch/software/clang-trunk/bin/clang-14+0x48adaa8)
#23 0x000055ec3f26fbc3
llvm::DwarfCompileUnit::createScopeChildrenDIE(llvm::LexicalScope*,
llvm::SmallVectorImpl<llvm::DIE*>&, bool*)
(/scratch/software/clang-trunk/bin/clang-14+0x48abbc3)
#24 0x000055ec3f27119a
llvm::DwarfCompileUnit::createAndAddScopeChildren(llvm::LexicalScope*,
llvm::DIE&) (/scratch/software/clang-trunk/bin/clang-14+0x48ad19a)
#25 0x000055ec3f271807
llvm::DwarfCompileUnit::constructSubprogramScopeDIE(llvm::DISubprogram const*,
llvm::LexicalScope*) (/scratch/software/clang-trunk/bin/clang-14+0x48ad807)
#26 0x000055ec3f2011a3 llvm::DwarfDebug::endFunctionImpl(llvm::MachineFunction
const*) (/scratch/software/clang-trunk/bin/clang-14+0x483d1a3)
#27 0x000055ec3f1ccc32
llvm::DebugHandlerBase::endFunction(llvm::MachineFunction const*)
(/scratch/software/clang-trunk/bin/clang-14+0x4808c32)
#28 0x000055ec3f1c8102 llvm::AsmPrinter::emitFunctionBody()
(/scratch/software/clang-trunk/bin/clang-14+0x4804102)
#29 0x000055ec3cd43f06
llvm::X86AsmPrinter::runOnMachineFunction(llvm::MachineFunction&)
(/scratch/software/clang-trunk/bin/clang-14+0x237ff06)
#30 0x000055ec3d57b4f8
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/scratch/software/clang-trunk/bin/clang-14+0x2bb74f8)
#31 0x000055ec3da76905 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/scratch/software/clang-trunk/bin/clang-14+0x30b2905)
#32 0x000055ec3da76b49 llvm::FPPassManager::runOnModule(llvm::Module&)
(/scratch/software/clang-trunk/bin/clang-14+0x30b2b49)
#33 0x000055ec3da77c32 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/scratch/software/clang-trunk/bin/clang-14+0x30b3c32)
#34 0x000055ec3e741f63 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef,
llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/scratch/software/clang-trunk/bin/clang-14+0x3d7df63)
#35 0x000055ec3f5e8493
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/scratch/software/clang-trunk/bin/clang-14+0x4c24493)
#36 0x000055ec4069d829 clang::ParseAST(clang::Sema&, bool, bool)
(/scratch/software/clang-trunk/bin/clang-14+0x5cd9829)
#37 0x000055ec3f5e6e48 clang::CodeGenAction::ExecuteAction()
(/scratch/software/clang-trunk/bin/clang-14+0x4c22e48)
#38 0x000055ec3ee5bfe9 clang::FrontendAction::Execute()
(/scratch/software/clang-trunk/bin/clang-14+0x4497fe9)
#39 0x000055ec3edeadde
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/scratch/software/clang-trunk/bin/clang-14+0x4426dde)
#40 0x000055ec3ef3c523
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/scratch/software/clang-trunk/bin/clang-14+0x4578523)
#41 0x000055ec3bb8058d cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/scratch/software/clang-trunk/bin/clang-14+0x11bc58d)
#42 0x000055ec3bb7c998 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#43 0x000055ec3baa4099 main
(/scratch/software/clang-trunk/bin/clang-14+0x10e0099)
#44 0x00007faac60e30b3 __libc_start_main
/build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:342:3
#45 0x000055ec3bb7c50e _start
(/scratch/software/clang-trunk/bin/clang-14+0x11b850e)
clang-14: error: unable to execute command: Aborted (core dumped)
clang-14: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 14.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
91434d44699642075378c888bf61715ff2d9e23f)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/cnsun/usr/bin
clang-14: note: diagnostic msg:
********************

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

********************</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>