<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 with "NumBits >= MIN_INT_BITS && bitwidth too small failed""
   href="https://llvm.org/bugs/show_bug.cgi?id=26169">26169</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crashes on x86_64-linux-gnu with "NumBits >= MIN_INT_BITS && bitwidth too small 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>Linux
          </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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>helloqirun@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 current clang trunk crashes when compiling the following test case on
x86_64-linux-gnu in both 32-bit and 64-bit modes. 


It might be a regression from 3.5.X.




$ clang-trunk -v
clang version 3.9.0 (trunk 257876)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8.4
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.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.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.1
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 -c abc.c
clang: /home/absozero/trunk/llvm/lib/IR/Type.cpp:250: static llvm::IntegerType
*llvm::IntegerType::get(llvm::LLVMContext &, unsigned int): Assertion `NumBits
<span class="quote">>= MIN_INT_BITS && "bitwidth too small"' failed.</span >
#0 0x00000000030a2ac8 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/absozero/trunk/root-clang/bin/clang+0x30a2ac8)
#1 0x00000000030a3237 (/home/absozero/trunk/root-clang/bin/clang+0x30a3237)
#2 0x00007fd8e8658340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#3 0x00007fd8e743ccc9 gsignal
/build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#4 0x00007fd8e74400d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#5 0x00007fd8e7435b86 __assert_fail_base
/build/buildd/eglibc-2.19/assert/assert.c:92:0
#6 0x00007fd8e7435c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#7 0x000000000300c307 llvm::IntegerType::get(llvm::LLVMContext&, unsigned int)
(/home/absozero/trunk/root-clang/bin/clang+0x300c307)
#8 0x0000000000b38582 (/home/absozero/trunk/root-clang/bin/clang+0xb38582)
#9 0x0000000000b3b49f (/home/absozero/trunk/root-clang/bin/clang+0xb3b49f)
#10 0x0000000000b3a846
clang::CodeGen::CodeGenFunction::EmitAtomicStore(clang::CodeGen::RValue,
clang::CodeGen::LValue, llvm::AtomicOrdering, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang+0xb3a846)
#11 0x0000000000b39dae
clang::CodeGen::CodeGenFunction::EmitAtomicStore(clang::CodeGen::RValue,
clang::CodeGen::LValue, bool)
(/home/absozero/trunk/root-clang/bin/clang+0xb39dae)
#12 0x0000000000bbd358 (/home/absozero/trunk/root-clang/bin/clang+0xbbd358)
#13 0x0000000000bbaaef clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot)
(/home/absozero/trunk/root-clang/bin/clang+0xbbaaef)
#14 0x0000000000b9cc59 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot, bool)
(/home/absozero/trunk/root-clang/bin/clang+0xb9cc59)
#15 0x0000000000a4c68b clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*) (/home/absozero/trunk/root-clang/bin/clang+0xa4c68b)
#16 0x0000000000a562bc
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/home/absozero/trunk/root-clang/bin/clang+0xa562bc)
#17 0x0000000000a86fb7
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/home/absozero/trunk/root-clang/bin/clang+0xa86fb7)
#18 0x0000000000a9ab75
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/home/absozero/trunk/root-clang/bin/clang+0xa9ab75)
#19 0x0000000000a965e3
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/home/absozero/trunk/root-clang/bin/clang+0xa965e3)
#20 0x0000000000a9ca97
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*)
(/home/absozero/trunk/root-clang/bin/clang+0xa9ca97)
#21 0x0000000000a0784f (/home/absozero/trunk/root-clang/bin/clang+0xa0784f)
#22 0x00000000009fa327 (/home/absozero/trunk/root-clang/bin/clang+0x9fa327)
#23 0x0000000000caf963 clang::ParseAST(clang::Sema&, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang+0xcaf963)
#24 0x0000000000789625 clang::FrontendAction::Execute()
(/home/absozero/trunk/root-clang/bin/clang+0x789625)
#25 0x0000000000751651
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/absozero/trunk/root-clang/bin/clang+0x751651)
#26 0x000000000073019c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/absozero/trunk/root-clang/bin/clang+0x73019c)
#27 0x0000000000725d78 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/absozero/trunk/root-clang/bin/clang+0x725d78)
#28 0x000000000072e843 main
(/home/absozero/trunk/root-clang/bin/clang+0x72e843)
#29 0x00007fd8e7427ec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#30 0x000000000072581d _start
(/home/absozero/trunk/root-clang/bin/clang+0x72581d)
Stack dump:
0.    Program arguments: /home/absozero/trunk/root-clang/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
abc.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -target-linker-version 2.24
-dwarf-column-info -debugger-tuning=gdb -coverage-file
/home/absozero/projects/reduction/abc.c -resource-dir
/home/absozero/trunk/root-clang/bin/../lib/clang/3.9.0 -internal-isystem
/usr/local/include -internal-isystem
/home/absozero/trunk/root-clang/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
-fdebug-compilation-dir /home/absozero/projects/reduction -ferror-limit 19
-fmessage-length 142 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -o abc.o -x c abc.c 
1.    <eof> parser at end of file
2.    abc.c:4:6: LLVM IR generation of declaration 'fn1'
3.    abc.c:4:6: Generating code for declaration '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 257876)
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/abc-aad357.c
clang: note: diagnostic msg: /tmp/abc-aad357.sh
clang: note: diagnostic msg: 

********************



-------------------
$ cat abc.c
struct s {
} _Atomic a;
struct s b;
void fn1() { a = b; }</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>