diff options
author | johnvg | 2003-01-24 16:02:13 +0000 |
---|---|---|
committer | johnvg | 2003-01-24 16:02:13 +0000 |
commit | 1d79c1dba43c88d46ecb4ffed7a1419cbec0e85c (patch) | |
tree | 53ee9141e0e2e2ba8a06c6262d09a912db026adf /backendC/CleanCompilerSources | |
parent | added convertSymbolTypeWithoutCollectingImportedConstructors (diff) |
bug fixes: prevent crash in ReduceArguments and set e_hasind
for the node that the indirection node refers to, instead of
for the indirection node itself
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@1314 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'backendC/CleanCompilerSources')
-rw-r--r-- | backendC/CleanCompilerSources/sa.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/backendC/CleanCompilerSources/sa.c b/backendC/CleanCompilerSources/sa.c index cf74d4a..d1eb916 100644 --- a/backendC/CleanCompilerSources/sa.c +++ b/backendC/CleanCompilerSources/sa.c @@ -1869,6 +1869,9 @@ static void UpdateExp (Exp src, Exp dst) dst->e_deps = Null; return; case Ind: +#ifdef _DB_ + FPrintF (outfile, "Update with indirection %u %u\n", src->e_add,dst->e_add); +#endif dst->e_sym = src->e_sym; arity = 1; break; @@ -2992,7 +2995,7 @@ static StrictPositionsP StrictPositionsCopy (void) sizeBits = strict_positions_last_one; #endif - Assume (size < kMaxStrictPositions, "too many strict positions", "StrictPositionsToInts"); + Assume (sizeBits < kMaxStrictPositions, "too many strict positions", "StrictPositionsToInts"); if (sizeBits == 0) { @@ -4842,11 +4845,13 @@ static void ReduceArguments (Exp e) arity = e->e_fun->fun_arity; for (i = 0; i < arity; i++){ -#ifdef _DB_ +#if 0 && defined (_DB_) printf ("Reduce argument %d\n",i); #endif + (void) ReduceInContext (& e->e_args[i], (Path) Null, NewSimpleContext (HnfStrict, True)); -#ifdef _DB_ + +#if 0 && defined (_DB_) printf ("End reduce argument %d\n",i); #endif } @@ -4908,13 +4913,16 @@ static void Reduce (ExpP ep, Path p, Context context) start_fuel+=saved_fuel1; #endif - if (e->e_fun->fun_kind == Function && StrictDoEager){ + if (e->e_fun->fun_kind==Function && StrictDoEager){ #ifdef DIVIDE_FUEL if (start_fuel>saved_fuel2){ start_fuel-=saved_fuel2; #endif e = *ep; - ReduceArguments (e); + /* JVG added 23-1-2003: */ + if (e->e_kind==Value && e->e_fun->fun_kind==Function) + /* */ + ReduceArguments (e); #ifdef DIVIDE_FUEL start_fuel+=saved_fuel2; } @@ -4995,7 +5003,12 @@ static Bool CheckEndOfReductions (ExpP ep, Path p, Context context, Bool *result /* check if current exp is already under reduction */ if (e->e_red){ *ep = MakeIndirection (e); + + /* JVG changed 23-1-2003: */ + e->e_hasind = True; + /* (*ep)->e_hasind = True; + */ #ifdef _DB_RED_ if (DBPrinting){ FPrintF (outfile, "Result is indirection: "); @@ -5535,7 +5548,8 @@ int init_strictness_analysis (ImpMod imod) /* Initialise all */ #ifdef _DB_ cur_add = 1; - outfile = StdOut; +/* outfile = StdOut; */ + outfile = fopen ("SADump","w"); /* StrictDoLists = True; */ DBPrinting = False; #endif @@ -5576,8 +5590,7 @@ int init_strictness_analysis (ImpMod imod) GiveStrictWarning (NULL,"not enough memory for strictness analysis"); #ifdef _DB_ -/* FClose (outfile); -*/ + FClose (outfile); #endif return False; } @@ -5612,9 +5625,7 @@ void do_strictness_analysis (void) #endif #ifdef _DB_ -/* FClose (outfile); -*/ #endif #if 0 |