-
Notifications
You must be signed in to change notification settings - Fork 21
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
Stack variable and printf cause crash #10
Comments
You are right. The reason for this is that external function calls are not currently allowed to read/write any automatic variables. This can be somewhat limiting in some cases, but it does help with some optimizations. I am not very inclined to fix this at the moment, but I will keep the issue open. |
Did you add some helpful error message when the user does this? Crashing is a bit unfortunate |
(Sorry, I inadvertently closed the issue; reopening.) I didn't, but will do in the next release. In the meantime, you can apply the following patch. BTW, do you encounter this only for
|
@lilith218 has more experience using external functions, maybe she can comment. |
hmm this could be similar, if not the same to the one I reported yesterday. |
Indeed, this is the same as #26. The reason why the crash also manifests with In general, external functions that manipulate stack variables currently cause crashes. Static variables should be fine, but external calls will only see the initial values of these variables and not any updated values. |
The crash also occurs without the initializer (using some other way to set up
str
).The crash does not occur if
str
is changed to static storage duration (I've tried both using the static keyword and moving it outside the function).The text was updated successfully, but these errors were encountered: