[llvm-bugs] [Bug 26425] New: clang crashes on valid code at -O2 and above on x86_64-linux-gnu running pass “X86 DAG-?=>=?UTF-8?Q?DAG Instruction Selection”

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 1 14:45:58 PST 2016


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

            Bug ID: 26425
           Summary: clang crashes on valid code at -O2 and above on
                    x86_64-linux-gnu running pass “X86 DAG->DAG
                    Instruction Selection”
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: helloqirun at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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

It might be a regression form 3.3.


$ clang-trunk -v
clang version 3.9.0 (trunk 259346) (llvm/trunk 259345)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/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.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.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.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-trunk abc.c -O2 -c
#0 0x00000000018f1c75 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x18f1c75)
#1 0x00000000018efe86 llvm::sys::RunSignalHandlers()
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x18efe86)
#2 0x00000000018f0075 SignalHandler(int)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x18f0075)
#3 0x00007f70b889b340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x000000000136938b llvm::MachineRegisterInfo::constrainRegClass(unsigned
int, llvm::TargetRegisterClass const*, unsigned int)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x136938b)
#5 0x0000000001f21fe3
llvm::InstrEmitter::AddRegisterOperand(llvm::MachineInstrBuilder&,
llvm::SDValue, unsigned int, llvm::MCInstrDesc const*,
llvm::DenseMap<llvm::SDValue, unsigned int, llvm::DenseMapInfo<llvm::SDValue>,
llvm::detail::DenseMapPair<llvm::SDValue, unsigned int> >&, bool, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1f21fe3)
#6 0x0000000001f228f9
llvm::InstrEmitter::AddOperand(llvm::MachineInstrBuilder&, llvm::SDValue,
unsigned int, llvm::MCInstrDesc const*, llvm::DenseMap<llvm::SDValue, unsigned
int, llvm::DenseMapInfo<llvm::SDValue>,
llvm::detail::DenseMapPair<llvm::SDValue, unsigned int> >&, bool, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1f228f9)
#7 0x0000000001f27a99 llvm::InstrEmitter::EmitMachineNode(llvm::SDNode*, bool,
bool, llvm::DenseMap<llvm::SDValue, unsigned int,
llvm::DenseMapInfo<llvm::SDValue>, llvm::detail::DenseMapPair<llvm::SDValue,
unsigned int> >&) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x1f27a99)
#8 0x0000000001f1dad1
llvm::ScheduleDAGSDNodes::EmitSchedule(llvm::MachineBasicBlock::bundle_iterator<llvm::MachineInstr,
llvm::ilist_iterator<llvm::MachineInstr> >&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1f1dad1)
#9 0x0000000001eb262b llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1eb262b)
#10 0x0000000001eb9fea
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1eb9fea)
#11 0x0000000001ebb70f
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1ebb70f)
#12 0x0000000000ff37c4 (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0xff37c4)
#13 0x000000000158160a llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x158160a)
#14 0x0000000001581bd3 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1581bd3)
#15 0x0000000001a1331b clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::StringRef, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1a1331b)
#16 0x0000000001f54bc6
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1f54bc6)
#17 0x000000000222204d clang::ParseAST(clang::Sema&, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x222204d)
#18 0x0000000001cdc646 clang::FrontendAction::Execute()
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1cdc646)
#19 0x0000000001cb7956
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1cb7956)
#20 0x0000000001d5fa93
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1d5fa93)
#21 0x00000000008c15a8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x8c15a8)
#22 0x00000000008758f9 main
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x8758f9)
#23 0x00007f70b7aa4ec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#24 0x00000000008bf214 _start
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x8bf214)
Stack dump:
0.      Program arguments: /home/absozero/trunk/root-clang/bin/clang-3.9 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -disable-free -disable-llvm-verifier
-main-file-name abc.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
/home/absozero/projects/reduction/crash/abc.c -resource-dir
/home/absozero/trunk/root-clang/bin/../lib/clang/3.9.0 -internal-isystem
/usr/local/include -internal-isystem
/home/absozero/trunk/root-clang/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 -O2
-fdebug-compilation-dir /home/absozero/projects/reduction/crash -ferror-limit
19 -fmessage-length 172 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -o abc.o -x c abc.c
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'abc.c'.
4.      Running pass 'X86 DAG->DAG Instruction Selection' on function '@fn3'
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 259346) (llvm/trunk 259345)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/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/abc-52eedb.c
clang-3.9: note: diagnostic msg: /tmp/abc-52eedb.sh
clang-3.9: note: diagnostic msg:

********************


-----
$ cat abc.c
int a, c, d, f, g;
char b, i;
volatile int e;
int(fn1)(int p1, int p2) { return (p1 * p2); }
int fn2() {
  {
    g = a;
    {
      char h = a;
      f = h + b;
    }
    return c;
  }
}
int fn3() {
  int j = fn1(d, !++e);
  {
    signed k = j;
    char l = d;
    i = (k - l);
  }
  short m = i;
  return m;
}

-- 
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/20160201/2a247b46/attachment-0001.html>


More information about the llvm-bugs mailing list