compilation regression, "fatal error: error in backend: Cannot select..."

Hello llvm folks,

I use clang to build a few open source projects nightly. I update my
build of clang periodically, and yesterday updated from r130865 to
r132417. As a result, the vxl project no longer compiles, with this error:

<http://www.cdash.org/CDash/viewBuildError.php?buildid=1189394>

fatal error: error in backend: Cannot select: 0x1036ddc10: f32 =
X86ISD::FSETCCss 0x10371ec10, 0x1036dd310, 0x10372c910 [ID=26] dbg:/usr/
include/c++/4.2.1/complex:450:7
  0x10371ec10: f80,ch = load 0x103698a10:1, 0x103698a10,
0x10373ab10<LD10[%12](align=16)> [ORD=696] [ID=18] dbg:/usr/include/c++/
4.2.1/complex:450:7
    0x103698a10: i64,ch,glue = CopyFromReg 0x1036ddb10, 0x1036dd810,
0x1036ddb10:1 [ORD=694] [ID=16] dbg:/usr/include/c++/4.2.1/complex:450:7
      0x1036dd810: i64 = Register %RAX [ORD=694] [ID=6]
      0x1036ddb10: ch,glue = callseq_end 0x103698e10, 0x103698910,
0x103698910, 0x103698e10:1 [ORD=694] [ID=15]
        0x103698910: i64 = TargetConstant<0> [ORD=694] [ID=3]
        0x103698910: i64 = TargetConstant<0> [ORD=694] [ID=3]
        0x103698e10: ch,glue = X86ISD::CALL 0x103699610, 0x10371ef10,
0x10372c210, 0x103699610:1 [ORD=694] [ID=14] dbg:/usr/include/c++/4.2.1/
complex:450:7
          0x10371ef10: i64 = TargetGlobalAddress<x86_fp80*
(%"struct.std::complex"*)* @_ZNKSt7complexIeE4imagEv> 0 [ORD=694] [ID=5]
dbg:/usr/include/c++/4.2.1/complex:450:7
          0x10372c210: i64 = Register %RDI [ORD=694] [ID=4]
          0x103699610: ch,glue = CopyToReg 0x10373ad10, 0x10372c210,
0x103699010 [ORD=694] [ID=13] dbg:/usr/include/c++/4.2.1/complex:450:7
            0x10372c210: i64 = Register %RDI [ORD=694] [ID=4]
            0x103699010: i64,ch = load 0x103b38608, 0x10372c410,
0x10373ab10<LD8[%1]> [ORD=693] [ID=11] dbg:/usr/include/c++/4.2.1/
complex:450:7
              0x10372c410: i64 = FrameIndex<0> [ORD=693] [ID=1]
              0x10373ab10: i64 = undef [ORD=693] [ID=2]
    0x10373ab10: i64 = undef [ORD=693] [ID=2]
  0x1036dd310: f80,ch = load 0x103699110:1, 0x103699110,
0x10373ab10<LD10[%15](align=16)> [ORD=700] [ID=25] dbg:/usr/include/c++/
4.2.1/complex:450:7
    0x103699110: i64,ch,glue = CopyFromReg 0x103699510, 0x1036dd810,
0x103699510:1 [ORD=698] [ID=24] dbg:/usr/include/c++/4.2.1/complex:450:7
      0x1036dd810: i64 = Register %RAX [ORD=694] [ID=6]
      0x103699510: ch,glue = callseq_end 0x10371e410, 0x103698910,
0x103698910, 0x10371e410:1 [ORD=698] [ID=23]
        0x103698910: i64 = TargetConstant<0> [ORD=694] [ID=3]
        0x103698910: i64 = TargetConstant<0> [ORD=694] [ID=3]
        0x10371e410: ch,glue = X86ISD::CALL 0x10372bf10, 0x10371ef10,
0x10372c210, 0x10372bf10:1 [ORD=698] [ID=22] dbg:/usr/include/c++/4.2.1/
complex:450:7
          0x10371ef10: i64 = TargetGlobalAddress<x86_fp80*
(%"struct.std::complex"*)* @_ZNKSt7complexIeE4imagEv> 0 [ORD=694] [ID=5]
dbg:/usr/include/c++/4.2.1/complex:450:7
          0x10372c210: i64 = Register %RDI [ORD=694] [ID=4]
          0x10372bf10: ch,glue = CopyToReg 0x10372c810, 0x10372c210,
0x10373ae10 [ORD=698] [ID=21] dbg:/usr/include/c++/4.2.1/complex:450:7
            0x10372c210: i64 = Register %RDI [ORD=694] [ID=4]
            0x10373ae10: i64,ch = load 0x103698a10:1, 0x10372c710,
0x10373ab10<LD8[%2]> [ORD=697] [ID=17] dbg:/usr/include/c++/4.2.1/
complex:450:7
              0x10372c710: i64 = FrameIndex<1> [ORD=697] [ID=7]
              0x10373ab10: i64 = undef [ORD=693] [ID=2]
    0x10373ab10: i64 = undef [ORD=693] [ID=2]
  0x10372c910: i8 = Constant<0> [ID=9]

Is this known?

Thanks,

Looks like it's caused by Stuart's recent change.

Evan

Yes, this is almost certainly my fault.

Sean, could you advise me how to extract a test case to reproduce this?

Thank you,

stuart

I'm afraid I neither know much about the vxl project nor C++. (I build
it nightly because it is a dependency of a dependency of my application,
and as I hope to switch to clang one day, I contribue the nightly build
so that the vxl developers can keep their code building with clang.)

I image you should be able to repro by building vxl with clang.

<https://vxl.svn.sourceforge.net/svnroot/vxl/trunk/>

It needs CMake to build. Perhaps you are already familiar with CMake
from it's use in llvm/clang? If not, basic instructions here:

<http://vxl.sourceforge.net/releases/install-latest.html>

Cheers,

It'd make investigators life easier if it is possible for you to get the bitcode file. If you build it then probably you can find the clang command line that is crashing with this fatal error then you can easily extract bitcode file. If the command line is

$ clang <various compiler options> -c foo.c -o foo.o

then do

$ clang <various compiler options> -c foo.c -emit-llvm -o foo.bc

foo.bc is a bitcode file that can immensely help someone track this crash without setting up vxl project.

OK, I created a bug with this .bc file:

<http://llvm.org/bugs/show_bug.cgi?id=10088>

Cheers,