mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-29 18:52:30 +00:00 
			
		
		
		
	opt_merge: fix dangling pointers in known_cells when keep attribute is used
This commit is contained in:
		
							parent
							
								
									33bfc9d19c
								
							
						
					
					
						commit
						1d773b50a4
					
				
					 1 changed files with 3 additions and 1 deletions
				
			
		|  | @ -154,7 +154,7 @@ struct OptMergeWorker | ||||||
| 
 | 
 | ||||||
| 	bool compare_cell_parameters_and_connections(const RTLIL::Cell *cell1, const RTLIL::Cell *cell2) const | 	bool compare_cell_parameters_and_connections(const RTLIL::Cell *cell1, const RTLIL::Cell *cell2) const | ||||||
| 	{ | 	{ | ||||||
| 		log_assert(cell1 != cell2); | 		if (cell1 == cell2) return true; | ||||||
| 		if (cell1->type != cell2->type) return false; | 		if (cell1->type != cell2->type) return false; | ||||||
| 
 | 
 | ||||||
| 		if (cell1->parameters != cell2->parameters) | 		if (cell1->parameters != cell2->parameters) | ||||||
|  | @ -313,6 +313,8 @@ struct OptMergeWorker | ||||||
| 					if (cell->has_keep_attr()) { | 					if (cell->has_keep_attr()) { | ||||||
| 						if (other_cell->has_keep_attr()) | 						if (other_cell->has_keep_attr()) | ||||||
| 							continue; | 							continue; | ||||||
|  | 						known_cells.erase(other_cell); | ||||||
|  | 						known_cells.insert(cell); | ||||||
| 						std::swap(other_cell, cell); | 						std::swap(other_cell, cell); | ||||||
| 					} | 					} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue