[llvm-bugs] [Bug 25754] New: clang crashes on valid code at -O1 and above on x86_64-linux-gnu (in 32-bit mode)

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Dec 5 11:13:27 PST 2015


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

            Bug ID: 25754
           Summary: clang crashes on valid code at -O1 and above on
                    x86_64-linux-gnu (in 32-bit mode)
           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 test case on
x86_64-linux-gnu at -O1 and above in the 32-bit mode (but not in 64-bit mode). 

This is a regression from 3.7.x. 


$ clang-trunk -v
clang version 3.8.0 (trunk 254740)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/tools/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.2.1
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.4
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.2.1
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-trunk -m32 -O0 -c small.c
$ clang-trunk -m64 -O1 -c small.c
$ clang-3.7.0 -m32 -O1 -c small.c
$
$ clang-trunk -m32 -O1 -c small.c
Do not know how to custom type legalize this operation!
UNREACHABLE executed at /tmp/llvm/lib/Target/X86/X86ISelLowering.cpp:19849!
#0 0x00000000030114b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang+0x30114b8)
#1 0x0000000003011c27 (/usr/local/clang-trunk/bin/clang+0x3011c27)
#2 0x00007f27deb78340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#3 0x00007f27ddb82cc9 gsignal
/build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#4 0x00007f27ddb860d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#5 0x0000000002ff6b0d llvm::llvm_unreachable_internal(char const*, char const*,
unsigned int) (/usr/local/clang-trunk/bin/clang+0x2ff6b0d)
#6 0x000000000237f77f
llvm::X86TargetLowering::ReplaceNodeResults(llvm::SDNode*,
llvm::SmallVectorImpl<llvm::SDValue>&, llvm::SelectionDAG&) const
(/usr/local/clang-trunk/bin/clang+0x237f77f)
#7 0x000000000257e1bc (/usr/local/clang-trunk/bin/clang+0x257e1bc)
#8 0x00000000025e21a8 (/usr/local/clang-trunk/bin/clang+0x25e21a8)
#9 0x000000000257a44d (/usr/local/clang-trunk/bin/clang+0x257a44d)
#10 0x0000000002580892 llvm::SelectionDAG::LegalizeTypes()
(/usr/local/clang-trunk/bin/clang+0x2580892)
#11 0x0000000002540e57 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/usr/local/clang-trunk/bin/clang+0x2540e57)
#12 0x000000000253fed7
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/usr/local/clang-trunk/bin/clang+0x253fed7)
#13 0x000000000253cfa0
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/usr/local/clang-trunk/bin/clang+0x253cfa0)
#14 0x0000000002318d51 (/usr/local/clang-trunk/bin/clang+0x2318d51)
#15 0x00000000026fb649
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang+0x26fb649)
#16 0x0000000002f587f4 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang+0x2f587f4)
#17 0x0000000002f58a3b llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang+0x2f58a3b)
#18 0x0000000002f58f05 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang+0x2f58f05)
#19 0x0000000000a0000d clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::StringRef, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*) (/usr/local/clang-trunk/bin/clang+0xa0000d)
#20 0x00000000009e0e88 (/usr/local/clang-trunk/bin/clang+0x9e0e88)
#21 0x0000000000c8dde6 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang+0xc8dde6)
#22 0x0000000000776d75 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang+0x776d75)
#23 0x0000000000741d41
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang+0x741d41)
#24 0x0000000000720f5e
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang+0x720f5e)
#25 0x0000000000716e58 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang+0x716e58)
#26 0x000000000071f603 main (/usr/local/clang-trunk/bin/clang+0x71f603)
#27 0x00007f27ddb6dec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#28 0x00000000007168e4 _start (/usr/local/clang-trunk/bin/clang+0x7168e4)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang -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
-target-linker-version 2.24 -momit-leaf-frame-pointer -dwarf-column-info
-coverage-file /data2/small.c -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/3.8.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.8.0/include -internal-externc-isystem
/include -internal-externc-isystem /usr/include -O1 -fdebug-compilation-dir
/data2 -ferror-limit 19 -fmessage-length 130 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -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 'X86 DAG->DAG Instruction Selection' on function '@fn1'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.8.0 (trunk 254740)
Target: i386-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/tools/bin
clang: 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: note: diagnostic msg:
********************

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

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


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


unsigned char a = 1, c = 2;
long long b;

void
fn1 ()
{ 
  a = b % (a % c) << a / c;
}

-- 
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/20151205/9eba1996/attachment.html>


More information about the llvm-bugs mailing list