[llvm-bugs] [Bug 37628] New: clang crashes on valid code at -O1 on x86_64-linux-gnu while running pass 'Value Propagation'

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 29 23:48:43 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37628

            Bug ID: 37628
           Summary: clang crashes on valid code at -O1 on x86_64-linux-gnu
                    while running pass 'Value Propagation'
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvm-bugs at lists.llvm.org

Tested with trunk revision 333424. 

$ clangpolly -v
clang version 7.0.0 (http://llvm.org/git/clang.git
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 (http://llvm.org/git/clang.git
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
http://llvm.org/bugs/ 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; 
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180530/7673dad4/attachment-0001.html>


More information about the llvm-bugs mailing list