aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backendC/CleanCompilerSources/backend.c16
-rw-r--r--backendC/CleanCompilerSources/sa.c5
2 files changed, 15 insertions, 6 deletions
diff --git a/backendC/CleanCompilerSources/backend.c b/backendC/CleanCompilerSources/backend.c
index 74e2b3b..1c979d1 100644
--- a/backendC/CleanCompilerSources/backend.c
+++ b/backendC/CleanCompilerSources/backend.c
@@ -3411,10 +3411,18 @@ BEStrictPositions (int functionIndex, int *bits, int **positions)
strict_positions = ruleType->type_alt_strict_positions;
- Assert (strict_positions != NULL);
-
- *bits = strict_positions->sp_size;
- *positions = strict_positions->sp_bits;
+ if (strict_positions == NULL)
+ {
+ /* this can happen if sa is turned of, or if the sa has failed
+ (for example when it's out of memory) */
+ *bits = 0;
+ *positions = NULL;
+ }
+ else
+ {
+ *bits = strict_positions->sp_size;
+ *positions = strict_positions->sp_bits;
+ }
} /* BEStrictPositions */
int
diff --git a/backendC/CleanCompilerSources/sa.c b/backendC/CleanCompilerSources/sa.c
index 4bc3d66..9ab5754 100644
--- a/backendC/CleanCompilerSources/sa.c
+++ b/backendC/CleanCompilerSources/sa.c
@@ -2910,10 +2910,11 @@ static void StrictPositionsClear (void)
{
int sizeBytes;
- sizeInts = bits2ints(kMaxStrictPositions);
+ sizeInts = bits2ints(kMaxStrictBits);
sizeBytes = sizeof (StrictPositionsS) + (sizeInts-1) * sizeof (int);
strict_positions = CompAlloc (sizeBytes);
-
+ for (i = 0; i < sizeInts; i++)
+ strict_positions->sp_bits[i] = 0;
strict_positions->sp_size = 0;
}