RegionStore::getLValueElement: Handle the case where the signedness of the
offset may be different that the base. Ultimately we need a better solution for these issues, but this point-by-point fixes are gradually outlining the scope of the problem. llvm-svn: 66638
This commit is contained in:
		
							parent
							
								
									154c963317
								
							
						
					
					
						commit
						90e213f025
					
				| 
						 | 
					@ -630,8 +630,12 @@ SVal RegionStoreManager::EvalBinOp(BinaryOperator::Opcode Op, Loc L, NonLoc R) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Only support concrete integer indexes for now.
 | 
					  // Only support concrete integer indexes for now.
 | 
				
			||||||
  if (Base && Offset) {
 | 
					  if (Base && Offset) {
 | 
				
			||||||
    SVal NewIdx = Base->EvalBinOp(getBasicVals(), Op, *Offset);
 | 
					    // For now, convert the signedness of offset in case it doesn't match.
 | 
				
			||||||
 | 
					    const llvm::APSInt &I =
 | 
				
			||||||
 | 
					      getBasicVals().ConvertSignedness(Base->getValue(), Offset->getValue());    
 | 
				
			||||||
 | 
					    nonloc::ConcreteInt OffsetConverted(I);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    SVal NewIdx = Base->EvalBinOp(getBasicVals(), Op, OffsetConverted);
 | 
				
			||||||
    const MemRegion* NewER = MRMgr.getElementRegion(NewIdx, 
 | 
					    const MemRegion* NewER = MRMgr.getElementRegion(NewIdx, 
 | 
				
			||||||
                                                    ER->getArrayRegion());
 | 
					                                                    ER->getArrayRegion());
 | 
				
			||||||
    return Loc::MakeVal(NewER);
 | 
					    return Loc::MakeVal(NewER);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue