Closed rtoy closed 4 months ago
Imported from SourceForge on 2024-07-08 15:03:49 Created by kjak on 2020-08-01 23:17:20 Original: https://sourceforge.net/p/maxima/bugs/2976/#a4d5
Imported from SourceForge on 2024-07-08 15:03:53 Created by kjak on 2020-08-01 23:17:20 Original: https://sourceforge.net/p/maxima/bugs/2976/#bcde
I have a fix for this and another bug I've found so far related to local
in translated code.
I'm changing the title of this report because it's not really specific to functions. For example, the same sort of bug you reported also occurs in a translated file where local
is used in a top-level block
.
Here's that other bug I mentioned. It's caused by an internal flag not being correctly set/unset:
(%i1) foo () := local ()$ /* just something with local */
(%i2) bar () := local ()$ /* same here */
(%i3) translate (foo);
(%o3) [foo]
(%i4) translate (bar); /* translate(foo) also fails here */
error: there is already a 'local' in this block.
error: failed to translate bar
(%o4) []
While I'm here I'll point out that using the same (translated) foo
as above we can actually make Maxima eventually run out of memory:
(%i5) do foo ();
It looks like this should just be an infinite loop because it doesn't seem like foo
does much of anything, but we run out of memory because every call is affecting some internal state that doesn't get cleaned up. (This is really just the same bug you reported.)
Anyway, I'll commit fixes for these soon after I look around for other related bugs and after I write up some other tests.
Imported from SourceForge on 2024-07-08 15:03:48 Created by tomasriker on 2015-06-13 18:36:39 Original: https://sourceforge.net/p/maxima/bugs/2976
local
doesn't work in compiled functions, as demonstrated by the following code:arr
's property of being a hashed array was leaked by the compiled functionf
, but not by the original non-compiled one.