mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Merge pull request #4326 from ethereum/compilerstack-cleanup
Properly catch optimizer/assembly exception in CompilerStack
This commit is contained in:
		
						commit
						2c456f0e70
					
				| @ -741,16 +741,20 @@ void CompilerStack::compileContract( | |||||||
| 	// 16-bit big endian length
 | 	// 16-bit big endian length
 | ||||||
| 	cborEncodedMetadata += toCompactBigEndian(cborEncodedMetadata.size(), 2); | 	cborEncodedMetadata += toCompactBigEndian(cborEncodedMetadata.size(), 2); | ||||||
| 
 | 
 | ||||||
| 	// Run optimiser and compile the contract.
 |  | ||||||
| 	compiler->compileContract(_contract, _compiledContracts, cborEncodedMetadata); |  | ||||||
| 
 |  | ||||||
| 	try | 	try | ||||||
| 	{ | 	{ | ||||||
| 		compiledContract.object = compiler->assembledObject(); | 		// Run optimiser and compile the contract.
 | ||||||
|  | 		compiler->compileContract(_contract, _compiledContracts, cborEncodedMetadata); | ||||||
| 	} | 	} | ||||||
| 	catch(eth::OptimizerException const&) | 	catch(eth::OptimizerException const&) | ||||||
| 	{ | 	{ | ||||||
| 		solAssert(false, "Assembly optimizer exception for bytecode"); | 		solAssert(false, "Optimizer exception during compilation"); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	try | ||||||
|  | 	{ | ||||||
|  | 		// Assemble deployment (incl. runtime)  object.
 | ||||||
|  | 		compiledContract.object = compiler->assembledObject(); | ||||||
| 	} | 	} | ||||||
| 	catch(eth::AssemblyException const&) | 	catch(eth::AssemblyException const&) | ||||||
| 	{ | 	{ | ||||||
| @ -759,12 +763,9 @@ void CompilerStack::compileContract( | |||||||
| 
 | 
 | ||||||
| 	try | 	try | ||||||
| 	{ | 	{ | ||||||
|  | 		// Assemble runtime object.
 | ||||||
| 		compiledContract.runtimeObject = compiler->runtimeObject(); | 		compiledContract.runtimeObject = compiler->runtimeObject(); | ||||||
| 	} | 	} | ||||||
| 	catch(eth::OptimizerException const&) |  | ||||||
| 	{ |  | ||||||
| 		solAssert(false, "Assembly optimizer exception for deployed bytecode"); |  | ||||||
| 	} |  | ||||||
| 	catch(eth::AssemblyException const&) | 	catch(eth::AssemblyException const&) | ||||||
| 	{ | 	{ | ||||||
| 		solAssert(false, "Assembly exception for deployed bytecode"); | 		solAssert(false, "Assembly exception for deployed bytecode"); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user