<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 --- - crash at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu (segmentation fault, AttributeSet::hasAttrSomewhere)"
   href="https://llvm.org/bugs/show_bug.cgi?id=30210">30210</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>crash at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu (segmentation fault, AttributeSet::hasAttrSomewhere)
          </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>Windows NT
          </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>$ clang-trunk -v
clang version 4.0.0 (trunk 280105)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.1
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.1.1
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
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.1.1
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.1.1
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

$ clang-trunk small.c -O3
#0 0x0000000001c0adc5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1c0adc5)
#1 0x0000000001c08a7e llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-4.0+0x1c08a7e)
#2 0x0000000001c08bcc SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-4.0+0x1c08bcc)
#3 0x00007fc695840ed0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10ed0)
#4 0x000000000178a3e7
llvm::AttributeSet::hasAttrSomewhere(llvm::Attribute::AttrKind, unsigned int*)
const (/usr/local/clang-trunk/bin/clang-4.0+0x178a3e7)
#5 0x000000000180b4e1 llvm::CallInst::getReturnedArgOperand() const
(/usr/local/clang-trunk/bin/clang-4.0+0x180b4e1)
#6 0x00000000013c3326 isDereferenceableAndAlignedPointer(llvm::Value const*,
unsigned int, llvm::APInt const&, llvm::DataLayout const&, llvm::Instruction
const*, llvm::DominatorTree const*, llvm::SmallPtrSetImpl<llvm::Value const*>&)
(/usr/local/clang-trunk/bin/clang-4.0+0x13c3326)
#7 0x00000000013c334e isDereferenceableAndAlignedPointer(llvm::Value const*,
unsigned int, llvm::APInt const&, llvm::DataLayout const&, llvm::Instruction
const*, llvm::DominatorTree const*, llvm::SmallPtrSetImpl<llvm::Value const*>&)
(/usr/local/clang-trunk/bin/clang-4.0+0x13c334e)
#8 0x00000000013c334e isDereferenceableAndAlignedPointer(llvm::Value const*,
unsigned int, llvm::APInt const&, llvm::DataLayout const&, llvm::Instruction
const*, llvm::DominatorTree const*, llvm::SmallPtrSetImpl<llvm::Value const*>&)
(/usr/local/clang-trunk/bin/clang-4.0+0x13c334e)
#9 0x00000000013c334e isDereferenceableAndAlignedPointer(llvm::Value const*,
unsigned int, llvm::APInt const&, llvm::DataLayout const&, llvm::Instruction
const*, llvm::DominatorTree const*, llvm::SmallPtrSetImpl<llvm::Value const*>&)
(/usr/local/clang-trunk/bin/clang-4.0+0x13c334e)
......................................
#249 0x00000000013c334e isDereferenceableAndAlignedPointer(llvm::Value const*,
unsigned int, llvm::APInt const&, llvm::DataLayout const&, llvm::Instruction
const*, llvm::DominatorTree const*, llvm::SmallPtrSetImpl<llvm::Value const*>&)
(/usr/local/clang-trunk/bin/clang-4.0+0x13c334e)
#250 0x00000000013c334e isDereferenceableAndAlignedPointer(llvm::Value const*,
unsigned int, llvm::APInt const&, llvm::DataLayout const&, llvm::Instruction
const*, llvm::DominatorTree const*, llvm::SmallPtrSetImpl<llvm::Value const*>&)
(/usr/local/clang-trunk/bin/clang-4.0+0x13c334e)
#251 0x00000000013c334e isDereferenceableAndAlignedPointer(llvm::Value const*,
unsigned int, llvm::APInt const&, llvm::DataLayout const&, llvm::Instruction
const*, llvm::DominatorTree const*, llvm::SmallPtrSetImpl<llvm::Value const*>&)
(/usr/local/clang-trunk/bin/clang-4.0+0x13c334e)
#252 0x00000000013c334e isDereferenceableAndAlignedPointer(llvm::Value const*,
unsigned int, llvm::APInt const&, llvm::DataLayout const&, llvm::Instruction
const*, llvm::DominatorTree const*, llvm::SmallPtrSetImpl<llvm::Value const*>&)
(/usr/local/clang-trunk/bin/clang-4.0+0x13c334e)
#253 0x00000000013c334e isDereferenceableAndAlignedPointer(llvm::Value const*,
unsigned int, llvm::APInt const&, llvm::DataLayout const&, llvm::Instruction
const*, llvm::DominatorTree const*, llvm::SmallPtrSetImpl<llvm::Value const*>&)
(/usr/local/clang-trunk/bin/clang-4.0+0x13c334e)
#254 0x00000000013c334e isDereferenceableAndAlignedPointer(llvm::Value const*,
unsigned int, llvm::APInt const&, llvm::DataLayout const&, llvm::Instruction
const*, llvm::DominatorTree const*, llvm::SmallPtrSetImpl<llvm::Value const*>&)
(/usr/local/clang-trunk/bin/clang-4.0+0x13c334e)
#255 0x00000000013c334e isDereferenceableAndAlignedPointer(llvm::Value const*,
unsigned int, llvm::APInt const&, llvm::DataLayout const&, llvm::Instruction
const*, llvm::DominatorTree const*, llvm::SmallPtrSetImpl<llvm::Value const*>&)
(/usr/local/clang-trunk/bin/clang-4.0+0x13c334e)
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang-4.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 -debugger-tuning=gdb -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/4.0.0 -c-isystem . -c-isystem
/usr/local/include/csmith -internal-isystem /usr/local/include
-internal-isystem /usr/local/clang-trunk/bin/../lib/clang/4.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/temp/20160830-clang-trunk-m32-g-O3-build-030242/delta -ferror-limit
19 -fmessage-length 128 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -o /tmp/small-dc7af4.o -x c
small.c 
1.    <eof> parser at end of file
2.    Per-module optimization passes
3.    Running pass 'CallGraph Pass Manager' on module 'small.c'.
4.    Running pass 'Simplify the CFG' on function '@main'
clang-4.0: error: unable to execute command: Segmentation fault
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (trunk 280105)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-4.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-4.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-4.0: note: diagnostic msg: /tmp/small-88da90.c
clang-4.0: note: diagnostic msg: /tmp/small-88da90.sh
clang-4.0: note: diagnostic msg: 

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

$ cat small.c
int a, b, c, d, e, f, g;
int *fn1(int *p1) {
  if (a)
    if (b < g)
      if (c)
        for (; f; f++)
          if (c)
            __builtin_printf("index = %d%d%d\n", 0, b, d);
  if (e)
    __builtin_printf("index = %d%d\n", 0, f);
  __builtin_printf("g_37=%lld\n", (long long)a);
  return p1;
}
int main() {
  int i;
  short h = 4;
  int *j;
  for (;;) {
    while (e)
      h = 9;
    while (h)
      for (;;) {
        j = fn1(j);
        i = 0;
        for (; i < 10; i++)
          ;
        if (*j)
          break;
      }
  }
  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>