mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-30 16:17:05 +00:00 
			
		
		
		
	If SI->size() is 0, we are not allowed to dereference ->begin().
This fixed PR3078. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59416 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		| @@ -565,9 +565,11 @@ Function *ArgPromotion::DoPromotion(Function *F, | |||||||
|       // Add a parameter to the function for each element passed in. |       // Add a parameter to the function for each element passed in. | ||||||
|       for (ScalarizeTable::iterator SI = ArgIndices.begin(), |       for (ScalarizeTable::iterator SI = ArgIndices.begin(), | ||||||
|              E = ArgIndices.end(); SI != E; ++SI) { |              E = ArgIndices.end(); SI != E; ++SI) { | ||||||
|  |         unsigned num = SI->size(); | ||||||
|  |         // not allowed to dereference ->begin() if size() is 0 | ||||||
|         Params.push_back(GetElementPtrInst::getIndexedType(I->getType(), |         Params.push_back(GetElementPtrInst::getIndexedType(I->getType(), | ||||||
|                                                            &*SI->begin(), |                                                            num ? &*SI->begin(): 0, | ||||||
|                                                            SI->size())); |                                                            num)); | ||||||
|         assert(Params.back()); |         assert(Params.back()); | ||||||
|       } |       } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user