[llvm-bugs] [Bug 28269] New: clang crashes on valid code at -O1 and above on x86_64-linux-gnu running pass 'Interprocedural Sparse Conditional Constant Propagation'

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 22 16:06:39 PDT 2016


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

            Bug ID: 28269
           Summary: clang crashes on valid code at -O1 and above on
                    x86_64-linux-gnu running pass 'Interprocedural Sparse
                    Conditional Constant Propagation'
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The current clang trunk crashes when compiling the following code on
x86_64-linux-gnu at -O1 and above in both the 32-bit and 64-bit modes.

This is a regression from 3.8.x. 


$ clang -v
clang version 3.9.0 (trunk 273397)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/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.3
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.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.3.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
$
$ clang-3.8 -O1 -c -w small.c
$ clang-trunk -O0 -c -w small.c
$
$ clang-trunk -O1 -c -w small.c
#0 0x0000000001d231b5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1d231b5)
#1 0x0000000001d21046 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-3.9+0x1d21046)
#2 0x0000000001d21264 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-3.9+0x1d21264)
#3 0x00007f0ee80ea340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x0000000000de75f7 llvm::APInt::getLimitedValue(unsigned long) const
(/usr/local/clang-trunk/bin/clang-3.9+0xde75f7)
#5 0x0000000001c5fb30 (anonymous
namespace)::SCCPSolver::ResolvedUndefsIn(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1c5fb30)
#6 0x0000000001c6080b runIPSCCP(llvm::Module&, llvm::DataLayout const&,
llvm::TargetLibraryInfo const*)
(/usr/local/clang-trunk/bin/clang-3.9+0x1c6080b)
#7 0x0000000001988c18 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1988c18)
#8 0x0000000001e76508 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*) (/usr/local/clang-trunk/bin/clang-3.9+0x1e76508)
#9 0x0000000002493c3d
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2493c3d)
#10 0x00000000027ff1bd clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x27ff1bd)
#11 0x0000000002493f9e clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-3.9+0x2493f9e)
#12 0x00000000021a138e clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-3.9+0x21a138e)
#13 0x0000000002176b76
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2176b76)
#14 0x000000000222e1f2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-3.9+0x222e1f2)
#15 0x0000000000af05f8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-3.9+0xaf05f8)
#16 0x0000000000aa437c main (/usr/local/clang-trunk/bin/clang-3.9+0xaa437c)
#17 0x00007f0ee6ec6ec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#18 0x0000000000aec664 _start (/usr/local/clang-trunk/bin/clang-3.9+0xaec664)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-3.9 -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
-coverage-file /data2/small.c -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/3.9.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/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 -O1 -w -fdebug-compilation-dir /data2
-ferror-limit 19 -fmessage-length 147 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o small.o -x c small.c
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'Interprocedural Sparse Conditional Constant Propagation'
on module 'small.c'.
clang-3.9: error: unable to execute command: Segmentation fault (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 273397)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/tools/bin
clang-3.9: 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-3.9: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.9: note: diagnostic msg: /tmp/small-7efed4.c
clang-3.9: note: diagnostic msg: /tmp/small-7efed4.sh
clang-3.9: note: diagnostic msg:

********************
$


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


int a;

void foo ()
{ 
  int b = (foo == &a), c, d = 1, e = 0;
  if (d)
    (c = b, b = ~e);
  if (a)
    ~b >> b >> c | d;
}

-- 
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/20160622/a22ef63f/attachment-0001.html>


More information about the llvm-bugs mailing list