[LLVMdev] VirtRegMap GLIBCXX assert

Evan Cheng evan.cheng at apple.com
Tue Jul 10 23:58:48 PDT 2007


You are in luck. This function will be eliminated shortly. :-)

Evan

On Jul 10, 2007, at 11:57 AM, David A. Greene wrote:

> The following code in VirtRegMap.cpp is asserting in the C++ library
> because back() is called on an empty container:
>
>   /// addLastUse - Add the last use information of all stack slots  
> whose
>   /// values are available in the specific register.
>   void addLastUse(unsigned PhysReg, MachineInstr *Use) {
>     std::multimap<unsigned, int>::iterator I =
>       PhysRegsAvailable.lower_bound(PhysReg);
>     while (I != PhysRegsAvailable.end() && I->first == PhysReg) {
>       int Slot = I->second;
>       I++;
>
>       std::map<int, SSInfo>::iterator II = SpillSlotsAvailable.find 
> (Slot);
>       assert(II != SpillSlotsAvailable.end() && "Slot not  
> available!");
>       unsigned Val = II->second.first;
>       assert((Val >> 1) == PhysReg && "Bidirectional map mismatch!");
>       // This can be true if there are multiple uses of the same  
> register.
>       if (II->second.second.back() != Use)  <========== assert here
>         II->second.second.push_back(Use);
>     }
>   }
>
> This happens when llvm-gcc tries to build libgcc.
>
> An obvious fix is to change the line to:
>
>       if (II->second.second.empty() || II->second.second.back() !=  
> Use)
>
> Is this a proper fix?  Is there some assumption that II- 
> >second.second should
> NOT be empty at this point?  In other words, is this a simple  
> oversight bug or
> is there some deeper flaw in the program logic that gets exposed here?
>
>                                                    -Dave
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list