[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A possible bug in the call-by-name implementation of MARST
From: |
Andrew Makhorin |
Subject: |
Re: A possible bug in the call-by-name implementation of MARST |
Date: |
Sat, 20 Jan 2001 17:52:54 +0300 |
Thank you very much for your bug report!!!
Your test is excellent, because it has detected a serious bug in the
marst translator.
I've yet fixed the bug, so your test now works correctly; it prints:
HEAPSORT implementation is correct!
The error occurs due to incorrect passing a formal parameter called
by name to other procedure as actual parameter. The marst translator
*incorrectly* treats the procedure statement
foo(..., bar, ...)
where bar is a formal parameter called by name, as if it would be
foo(..., (bar), ...)
i.e. as if the value of 'bar' would be passed, not the name. That's
why you see a mistery message which means that the procedure 'foo'
tries to assign something to the formal parameter that corresponds to
the actual expression '(bar)'. (In your program the procedure
'OUTHEAP' passes its formal parameter 'out' which is called by name
as actual parameter to procedure 'SWOPHEAP', where it also is
declared as a parameter called by name; so, when the procedure
'SWOPHEAP' assigns a value to the parameter 'out', the notorious
error occurs.)
If you wouldn't like to wait for a new release of the marst package,
please, inform me, and I will send you a patch for 'marst.c'. However,
I need a time to check all modifications more carefully.
Best regards,
Andrew Makhorin,
the author and maintainer of GNU MARST