common-struct / polymorphism bug

Fergus Henderson fjh at cs.mu.oz.au
Mon Jun 16 19:49:26 AEST 1997


In mail to mercury-bugs, Thomas Charles CONWAY wrote:

> > re the bug that I reported on friday, poly.m:
> > 	Incidental testing reveals that it works for mercury-0.6,
> > 	and with mercury-latest at -O1 (-O2  and -O2 --no-inlining
> > 	both fail, however).

and I replied

> The compiler does the following steps:
> 
> 	- mode checking
> 	- simplification, which does common-struct elimination (with -O2)
> 	- lambda-elimination
> 
> The reason that it fails is that common-struct elimination does
> not preserve the mode information on lambda expressions that is
> used by lambda-elimination.  ...
> The problem is that common.m changes the non-local vars,
> but doesn't change the uni_modes field.
...
> I'm not sure what the best fix is.

Well, I have thought about it a bit, and I think the simplest fix is to
change the order of the passes so that simplify.m comes after
lambda-elimination.

Currently the order is 

		...
		unique_modes.m
		simplify.m
		polymorphism.m
		lambda.m
		...

I'm proposing changing it to

		...
		unique_modes.m
		polymorphism.m
		lambda.m
		simplify.m
		...

Comments?
(Did I miss anything?  Is there any reason why this might be a bad idea?)

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list