<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 - clang crashes on valid code at -O1 on x86_64-linux-gnu while running pass 'Value Propagation'"
   href="https://bugs.llvm.org/show_bug.cgi?id=37628">37628</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crashes on valid code at -O1 on x86_64-linux-gnu while running pass 'Value Propagation'
          </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>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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>su@cs.ucdavis.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Tested with trunk revision 333424. 

$ clangpolly -v
clang version 7.0.0 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
3de179a61e5c29a0f91918da87c692756bc755b4) (llvm/trunk 333424)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/su/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.4
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.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.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.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
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.0
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

$ clangpolly -O0 small.c

$ clangpolly -O1 small.c
Stack dump:
0.      Program arguments: /home/su/software/tmp/polly/llvm_build/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 -dwarf-column-info -debugger-tuning=gdb
-momit-leaf-frame-pointer -resource-dir
/home/su/software/tmp/polly/llvm_build/lib/clang/7.0.0 -internal-isystem
/usr/local/include -internal-isystem
/home/su/software/tmp/polly/llvm_build/lib/clang/7.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O1
-fdebug-compilation-dir
/home/su/specres/good/20180529-clangpolly-m64-O3-build-003121/delta
-ferror-limit 19 -fmessage-length 311 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/small-48cf7a.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 'Value Propagation' on function '@g'
#0 0x000000000258129a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/su/software/tmp/polly/llvm/lib/Support/Unix/Signals.inc:492:0
#1 0x000000000257f78a llvm::sys::RunSignalHandlers()
/home/su/software/tmp/polly/llvm/lib/Support/Signals.cpp:67:0
#2 0x000000000257f8b9 SignalHandler(int)
/home/su/software/tmp/polly/llvm/lib/Support/Unix/Signals.inc:351:0
#3 0x00007f14a9360330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00000000020074e7 llvm::AttributeList::hasAttribute(unsigned int,
llvm::Attribute::AttrKind) const
/home/su/software/tmp/polly/llvm/lib/IR/Attributes.cpp:1202:0
#5 0x0000000002007715
llvm::AttributeList::hasAttrSomewhere(llvm::Attribute::AttrKind, unsigned int*)
const /home/su/software/tmp/polly/llvm/lib/IR/Attributes.cpp:1231:0
#6 0x0000000001c8efde llvm::CallBase<llvm::CallInst>::getReturnedArgOperand()
const /home/su/software/tmp/polly/llvm/include/llvm/IR/Instructions.h:1473:0
#7 0x0000000001c8efde llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock
const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction
const, llvm::CallInst const, llvm::InvokeInst const, llvm::Use
const*>::getReturnedArgOperand() const
/home/su/software/tmp/polly/llvm/include/llvm/IR/CallSite.h:302:0
#8 0x0000000001c8efde
llvm::getArgumentAliasingToReturnedPointer(llvm::ImmutableCallSite)
/home/su/software/tmp/polly/llvm/lib/Analysis/ValueTracking.cpp:3397:0
#9 0x0000000001c9a375 isKnownNonZero(llvm::Value const*, unsigned int,
(anonymous namespace)::Query const&)
/home/su/software/tmp/polly/llvm/lib/Analysis/ValueTracking.cpp:1965:0
#10 0x0000000001c9a38e isKnownNonZero(llvm::Value const*, unsigned int,
(anonymous namespace)::Query const&)
/home/su/software/tmp/polly/llvm/lib/Analysis/ValueTracking.cpp:1966:0
#11 0x0000000001c9a38e isKnownNonZero(llvm::Value const*, unsigned int,
(anonymous namespace)::Query const&)
/home/su/software/tmp/polly/llvm/lib/Analysis/ValueTracking.cpp:1966:0
#12 0x0000000001c9a38e isKnownNonZero(llvm::Value const*, unsigned int,
(anonymous namespace)::Query const&)
/home/su/software/tmp/polly/llvm/lib/Analysis/ValueTracking.cpp:1966:0


...


#257 0x0000000001c9a38e isKnownNonZero(llvm::Value const*, unsigned int,
(anonymous namespace)::Query const&)
/home/su/software/tmp/polly/llvm/lib/Analysis/ValueTracking.cpp:1966:0
clang-6.0: error: unable to execute command: Segmentation fault (core dumped)
clang-6.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.0 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
3de179a61e5c29a0f91918da87c692756bc755b4) (llvm/trunk 333424)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/su/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-ce6d45.c
clang-6.0: note: diagnostic msg: /tmp/small-ce6d45.sh
clang-6.0: note: diagnostic msg: 

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



-------------------------------------


int a, b, d;
volatile int c;

int *e (int *f)
{
  return f;
}

void g ()
{
  int *h;
  while (a)
    {
      for (a = 0; a < 1;)
        ;
      while (d)
        h = e ((b && c, h));
    }
}

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