-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug of memory access after disposing it #39
Comments
I believe this is fundamentally a problem that should be fixed in the in voc the compiler always generates a dedicated variable for the result evaluates the expression on the return statement into it before calling Arguably the compiler should be more intelligent and avoid generating a result variable if the return statement does not reference the deleted but that's quite a big compiler change, so I excused myself by arguing the C compiler ought to optimise it to the same code anyway. The change is here: -- Dave. On 2016-08-01 13:33, Oleg N. Cher wrote:
Links:[1] #39 |
Oh, by the way, the commit I referenced below also includes a change to procedure Prefixed which predates the real fix and is not required. -- Dave. On 2016-08-01 14:19, dave wrote:
Links:[1] #39 |
Thank you for the answer, David. Then you can rollback the procedure Prefixed to the previous state. And how about the presence RETURN not only at the end, and in the body of a procedure? Like
Everything is work properly too? I'm sorry, but I have not tested on voc since I do not have a binary distribution of it. |
Yes, it handles return correctly wherever you put it. By the way you don't need a binary distribution of voc to build it - it C source that is ready to go. It's all handled automatically for you. Just git clone https://github.com/vishaps/voc, cd into voc and run make -- Dave. On 2016-08-01 16:05, Oleg N. Cher wrote:
Links:[1] #39 (comment) |
Dear David.
Once you've got rid of alloca in favor of an explicit allocation and deallocation, there was a problem that still doesn't solved, only masked.
Look at the last line of the C function. Here is the access into the memory which is already disposed. The way of alloca meant empty definition of __DEL(), and everything worked properly. But now __DEL() is
#define __DEL(x) Platform_OSFree((LONGINT)(uintptr_t)x)
So we have to solve this problem somehow. Such a solution, as below, as you have now, I find unsatisfactory.
If you are interested in how I'm doing. Now I will do:
And probably I'll go back to the use of alloca. I do not like this, but I did not come up with a better solution.
The text was updated successfully, but these errors were encountered: