[llvm-bugs] [Bug 31248] New: clang crashes on valid code at -O1 and above on x86_64-linux-gnu in 32-bit mode: running pass 'Early CSE'

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Dec 3 10:25:33 PST 2016


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

            Bug ID: 31248
           Summary: clang crashes on valid code at -O1 and above on
                    x86_64-linux-gnu in 32-bit mode: running pass 'Early
                    CSE'
           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

This should be a very recent regression. 

$ clang -v
clang version 4.0.0 (trunk 288490)
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.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
$
$ clang -m32 -O0 -w small.c
$ ./a.out
$
$ clang -m64 -O1 -w small.c
$ ./a.out
$
$ clang -m32 -O1 -w small.c
#0 0x0000000001f29225 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1f29225)
#1 0x0000000001f2730e llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-4.0+0x1f2730e)
#2 0x0000000001f27470 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-4.0+0x1f27470)
#3 0x00007f4ad9064330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x0000000001ad5174 llvm::ConstantExpr::isGEPWithNoNotionalOverIndexing()
const (/usr/local/clang-trunk/bin/clang-4.0+0x1ad5174)
#5 0x0000000001ac6587 evaluateICmpRelation(llvm::Constant*, llvm::Constant*,
bool) (/usr/local/clang-trunk/bin/clang-4.0+0x1ac6587)
#6 0x0000000001ac6a10 llvm::ConstantFoldCompareInstruction(unsigned short,
llvm::Constant*, llvm::Constant*)
(/usr/local/clang-trunk/bin/clang-4.0+0x1ac6a10)
#7 0x0000000001ae1c1b llvm::ConstantExpr::getICmp(unsigned short,
llvm::Constant*, llvm::Constant*, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x1ae1c1b)
#8 0x00000000016d37a9 SimplifyICmpInst(unsigned int, llvm::Value*,
llvm::Value*, (anonymous namespace)::Query const&, unsigned int)
(/usr/local/clang-trunk/bin/clang-4.0+0x16d37a9)
#9 0x00000000016d7ed4 llvm::SimplifyICmpInst(unsigned int, llvm::Value*,
llvm::Value*, llvm::DataLayout const&, llvm::TargetLibraryInfo const*,
llvm::DominatorTree const*, llvm::AssumptionCache*, llvm::Instruction const*)
(/usr/local/clang-trunk/bin/clang-4.0+0x16d7ed4)
#10 0x00000000016d9536 llvm::SimplifyInstruction(llvm::Instruction*,
llvm::DataLayout const&, llvm::TargetLibraryInfo const*, llvm::DominatorTree
const*, llvm::AssumptionCache*)
(/usr/local/clang-trunk/bin/clang-4.0+0x16d9536)
#11 0x0000000001d85870 (anonymous namespace)::EarlyCSE::run()
(/usr/local/clang-trunk/bin/clang-4.0+0x1d85870)
#12 0x0000000001d87efa (anonymous
namespace)::EarlyCSELegacyCommonPass<false>::runOnFunction(llvm::Function&)
[clone .part.426] (/usr/local/clang-trunk/bin/clang-4.0+0x1d87efa)
#13 0x0000000001b5a713 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1b5a713)
#14 0x0000000001b5a879
llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1b5a879)
#15 0x0000000001b5b137 llvm::legacy::FunctionPassManager::run(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1b5b137)
#16 0x00000000020ae42a clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/local/clang-trunk/bin/clang-4.0+0x20ae42a)
#17 0x0000000002709acc
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-4.0+0x2709acc)
#18 0x0000000002b1cd8c clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x2b1cd8c)
#19 0x000000000270464e clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-4.0+0x270464e)
#20 0x00000000023fceae clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-4.0+0x23fceae)
#21 0x00000000023d1f1e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-4.0+0x23d1f1e)
#22 0x000000000248c692
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-4.0+0x248c692)
#23 0x0000000000bd8f60 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-4.0+0xbd8f60)
#24 0x0000000000b7a305 main (/usr/local/clang-trunk/bin/clang-4.0+0xb7a305)
#25 0x00007f4ad7e3bf45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#26 0x0000000000bd511e _start (/usr/local/clang-trunk/bin/clang-4.0+0xbd511e)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-4.0 -cc1 -triple
i386-unknown-linux-gnu -emit-obj -disable-free -main-file-name small.c
-mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -fuse-init-array -target-cpu pentium4
-momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/4.0.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/4.0.0/include -internal-externc-isystem
/include -internal-externc-isystem /usr/include -O1 -w -fdebug-compilation-dir
/data2 -ferror-limit 19 -fmessage-length 157 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/small-e54c18.o -x c
small.c
1.      <eof> parser at end of file
2.      Per-function optimization
3.      Running pass 'Early CSE' on function '@main'
clang-4.0: error: unable to execute command: Segmentation fault (core dumped)
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (trunk 288490)
Target: i386-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
clang-4.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-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-f06bfb.c
clang-4.0: note: diagnostic msg: /tmp/small-f06bfb.sh
clang-4.0: note: diagnostic msg:

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


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


int a[1], b, c;

int main ()
{ 
  int d;
  while (1)
    { 
      if (b)
        { 
          int *e = &a[d];
          e < a;
          b = c;
        }
      break;
    }
  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/20161203/56330c77/attachment.html>


More information about the llvm-bugs mailing list