-
-
Notifications
You must be signed in to change notification settings - Fork 87
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 REPORT] Using "s" to read in a string doesn't generate the proper C code #183
Comments
@Martianmellow12 it seems that the issue only appears when compiled in linux, in macOS and Windows it works fine. Still it needs to be changed. But the issue with a constant length of 256 is -
I believe there should be some other option. If you get one do send it in this thread, if any of us get it we will send it here. |
You can take up this issue @Chasmiccoder. |
Okay. I will try. @frankhart2018 |
Assigning this to you @Chasmiccoder. |
Merged. |
Describe the bug
When
input
is called with"s"
as the input type, the generated C code doesn't work properly.To Reproduce
Below is a simc program accompanied by the generated C program:
simc
Generated C
Expected behavior
It's expected that whatever string was entered would be printed out, however all that's printed is
(null)
. Looking at the C code, it can be seen that the pointer we're trying to read a string into (char* i
) is only able to hold a single character, which is likely causing thenull
issue. To properly read in a string,char* i
should instead be something likechar i[256]
, or something similar (the exact size would depend on the size of the string being read in, so this implementation would require a limit on the maximum number of characters that can be read into the string).Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: