Browse Source

Fix crash in constant merging (bug reported by saubue).

git-svn-id: file:///var/svn/tigccpp/trunk/tigcc/ld-tigcc@282 9552661e-59e3-4036-b4f2-dbe53926924f
kevinkofler 18 years ago
parent
commit
88c62be053
1 changed files with 4 additions and 4 deletions
  1. 4 4
      constmrg.c

+ 4 - 4
constmrg.c

@@ -113,7 +113,7 @@ void MergeConstants (PROGRAM *Program)
 							InsertBefore (Section1->Symbols, CurSymbol, NextSymbol1);
 						}
 						// Delete Constant2.
-						if (Constant2Length == Section2->Size)
+						if (Constant2Length == Section2->Size && !NextSymbol2)
 						{
 							// Move the section symbol. We are deleting the section, so we need to
 							// put the symbol somewhere else. It should never be referenced anyway,
@@ -156,7 +156,7 @@ void MergeConstants (PROGRAM *Program)
 							InsertBefore (Section2->Symbols, CurSymbol, NextSymbol2);
 						}
 						// Delete Constant1.
-						if (Constant1Length == Section1->Size)
+						if (Constant1Length == Section1->Size && !NextSymbol1)
 						{
 							// Move the section symbol. We are deleting the section, so we need to
 							// put the symbol somewhere else. It should never be referenced anyway,
@@ -234,7 +234,7 @@ FreeAndOutOfMem:
 							}
 						}
 						// Delete Constant1.
-						if (Constant1Length == Section1->Size)
+						if (Constant1Length == Section1->Size && !NextSymbol1)
 						{
 							// Move the section symbol. We are deleting the section, so we need to
 							// put the symbol somewhere else. It should never be referenced anyway,
@@ -255,7 +255,7 @@ FreeAndOutOfMem:
 							FinalizeRangeCutting (Section1);
 						}
 						// Delete Constant2.
-						if (Constant2Length == Section2->Size)
+						if (Constant2Length == Section2->Size && !NextSymbol2)
 						{
 							// Move the section symbol. We are deleting the section, so we need to
 							// put the symbol somewhere else. It should never be referenced anyway,