Index: llvm/trunk/include/llvm/MC/MCRegisterInfo.h =================================================================== --- llvm/trunk/include/llvm/MC/MCRegisterInfo.h +++ llvm/trunk/include/llvm/MC/MCRegisterInfo.h @@ -271,6 +271,16 @@ NumSubRegIndices = NumIndices; SubRegIdxRanges = SubIdxRanges; RegEncodingTable = RET; + + // Initialize DWARF register mapping variables + EHL2DwarfRegs = nullptr; + EHL2DwarfRegsSize = 0; + L2DwarfRegs = nullptr; + L2DwarfRegsSize = 0; + EHDwarf2LRegs = nullptr; + EHDwarf2LRegsSize = 0; + Dwarf2LRegs = nullptr; + Dwarf2LRegsSize = 0; } /// \brief Used to initialize LLVM register to Dwarf Index: llvm/trunk/lib/MC/MCRegisterInfo.cpp =================================================================== --- llvm/trunk/lib/MC/MCRegisterInfo.cpp +++ llvm/trunk/lib/MC/MCRegisterInfo.cpp @@ -62,6 +62,8 @@ const DwarfLLVMRegPair *M = isEH ? EHL2DwarfRegs : L2DwarfRegs; unsigned Size = isEH ? EHL2DwarfRegsSize : L2DwarfRegsSize; + if (!M) + return -1; DwarfLLVMRegPair Key = { RegNum, 0 }; const DwarfLLVMRegPair *I = std::lower_bound(M, M+Size, Key); if (I == M+Size || I->FromReg != RegNum) @@ -73,6 +75,8 @@ const DwarfLLVMRegPair *M = isEH ? EHDwarf2LRegs : Dwarf2LRegs; unsigned Size = isEH ? EHDwarf2LRegsSize : Dwarf2LRegsSize; + if (!M) + return -1; DwarfLLVMRegPair Key = { RegNum, 0 }; const DwarfLLVMRegPair *I = std::lower_bound(M, M+Size, Key); assert(I != M+Size && I->FromReg == RegNum && "Invalid RegNum");