[llvm-bugs] [Bug 31271] New: clang crashes on valid code at -Os and above on x86_64-linux-gnu in 32-bit mode: running pass 'Two-Address instruction pass'

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Dec 5 09:22:38 PST 2016


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

            Bug ID: 31271
           Summary: clang crashes on valid code at -Os and above on
                    x86_64-linux-gnu in 32-bit mode: running pass
                    'Two-Address instruction pass'
           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

$ clang -v
clang version 4.0.0 (trunk 288617)
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 -O1 -c small.c
$
$ clang -m64 -Os -c small.c
$
$ clang -m32 -Os -c small.c
clang-4.0:
/tmp/llvm-builder/llvm-source-trunk/include/llvm/CodeGen/MachineOperand.h:421:
int64_t llvm::MachineOperand::getImm() const: Assertion `isImm() && "Wrong
MachineOperand accessor"' failed.
#0 0x0000000001f23505 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1f23505)
#1 0x0000000001f215ee llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-4.0+0x1f215ee)
#2 0x0000000001f21750 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-4.0+0x1f21750)
#3 0x00007f2c16124330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007f2c14f10c37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f2c14f14028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f2c14f09bf6 __assert_fail_base
/build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f2c14f09ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x0000000000841102 llvm::MachineOperand::getMBB() const [clone .part.85]
(/usr/local/clang-trunk/bin/clang-4.0+0x841102)
#9 0x0000000001588667
llvm::X86InstrInfo::convertToThreeAddress(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::MachineBasicBlock,
true, false, void>, false, false>&, llvm::MachineInstr&, llvm::LiveVariables*)
const (/usr/local/clang-trunk/bin/clang-4.0+0x1588667)
#10 0x00000000019c78a2 (anonymous
namespace)::TwoAddressInstructionPass::tryInstructionTransform(llvm::MachineInstrBundleIterator<llvm::MachineInstr,
false>&, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>&, unsigned
int, unsigned int, unsigned int, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x19c78a2)
#11 0x00000000019ca5da (anonymous
namespace)::TwoAddressInstructionPass::runOnMachineFunction(llvm::MachineFunction&)
(/usr/local/clang-trunk/bin/clang-4.0+0x19ca5da)
#12 0x000000000188b307
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-4.0+0x188b307)
#13 0x0000000001b548b3 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1b548b3)
#14 0x0000000001b5495c llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1b5495c)
#15 0x0000000001b5560a llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1b5560a)
#16 0x00000000020a87ae 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+0x20a87ae)
#17 0x000000000270430c
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-4.0+0x270430c)
#18 0x0000000002b177cc clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x2b177cc)
#19 0x00000000026fee8e clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-4.0+0x26fee8e)
#20 0x00000000023f74ce clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-4.0+0x23f74ce)
#21 0x00000000023cc53e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-4.0+0x23cc53e)
#22 0x0000000002486cc2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2486cc2)
#23 0x0000000000bd9030 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-4.0+0xbd9030)
#24 0x0000000000b7a6e5 main (/usr/local/clang-trunk/bin/clang-4.0+0xb7a6e5)
#25 0x00007f2c14efbf45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#26 0x0000000000bd51ee _start (/usr/local/clang-trunk/bin/clang-4.0+0xbd51ee)
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
-coverage-notes-file
/data2/c-hunter/test/compiler-testing-infrastructure/scripts/speculative-execution/good/20161203-clang-trunk-m32-O3-build-050618/small.gcno
-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 -Os -fdebug-compilation-dir
/data2/c-hunter/test/compiler-testing-infrastructure/scripts/speculative-execution/good/20161203-clang-trunk-m32-O3-build-050618
-ferror-limit 19 -fmessage-length 178 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o small.o -x c small.c
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'small.c'.
4.      Running pass 'Two-Address instruction pass' on function '@fn1'
clang-4.0: error: unable to execute command: Aborted (core dumped)
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (trunk 288617)
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-763f90.c
clang-4.0: note: diagnostic msg: /tmp/small-763f90.sh
clang-4.0: note: diagnostic msg:

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


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


int a, *b = &a, c[1], *d;

void fn1 ()
{ 
  d = &c[a];
  *b = b != d;
  if (!d)
    __builtin_abort ();
}

-- 
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/20161205/45ba86c8/attachment-0001.html>


More information about the llvm-bugs mailing list