diff options
author | ronny | 2001-11-26 14:40:02 +0000 |
---|---|---|
committer | ronny | 2001-11-26 14:40:02 +0000 |
commit | 58bc55b9685508743270c1529d61706fde7648a4 (patch) | |
tree | 3037afe4435cf8dd2a6357361d766f1900cf2ce3 | |
parent | fix explicit imports of cached modules (diff) |
bug fix in initialisation
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@904 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
-rw-r--r-- | backendC/CleanCompilerSources/backend.c | 16 | ||||
-rw-r--r-- | backendC/CleanCompilerSources/sa.c | 5 |
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; } |