-
Notifications
You must be signed in to change notification settings - Fork 19
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
Segmentation fault! #54
Comments
Hi @rdebath, do you have the source code for your helloworld.b ? Is it the one located in the tests folder? I will check it and answer as soon as possible! Thanks! |
Yes, it's the one in your tests folder, from Wikipedia. However, the problem seems to happen whatever is in the file, even just a newline (an empty file gives "No such file" !?) ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++. |
I think I had a linking problem related to that (and I fixed locally), but not cool, will fix it as soon as possible. This line may be causing it. We are depending currently on Just to test, try to run the command: |
I forgot to ask, is it on the |
Okay, I've now switched to the dev branch, recomplied and added the -c argument.
|
Sorry @rdebath but I couldn't reproduce your bug. It seems, superficially that something has changed between Here's what I've done:
Here's the output. I've removed GNU's copyright notice.
Again I tried with brain and I've got the same behavior.
|
Anyway, gonna inspect that profoundly later! |
Okay, I set off a build of clang 4.0.1, amd64 and then downgraded from 5.0.0. |
That's quite weird! I was discussing this issue on PR #55. It looks like a problem when linking |
We’re actually attaching LLVM IR (we’re compiling .c to .ll and only them attaching) as this is one of the plans of Brain for the future (attach other libraries into the code, so we can use all the power of LLVM), but the IO must go built-in later, the current solution has a lot of problems and is better to avoid them in the future. We already have a couple of issues regarding that and we will give priority to that. Thanks a lot for posting this issue @rdebath! |
Not so sure if the error above is related to that @rafaelcn. I guess I’ll install clang 5 over the weekend and try to replicate/fix it |
That was just a guess by the error provided in that SO answer. |
Yet, we need to discuss the future of the Math and the IO library :v |
WRT the math library the below should work fine. diff --git a/libs/io.c b/libs/io.c
index 40dd1ad..3d935b7 100644
--- a/libs/io.c
+++ b/libs/io.c
@@ -5,10 +5,6 @@
// you can overwrite those functions! :)
-int number_size(int number) {
- return floor(log10(abs(number))) + 1 + (number > 0 ? 0 : 1);
-}
-
void b_show_tape(int idx, int *cells, int size) {
// TODO: ellipsize values based on index
size = 12;
@@ -34,9 +30,9 @@ void b_show_tape(int idx, int *cells, int size) {
tape[tape_idx++] = ' ';
// Has a value allocated on register
if (*cells) {
- unsigned int value_size = number_size(*cells);
- char number[value_size];
- sprintf(number, "%d", *cells);
+ unsigned int value_size;
+ char number[sizeof(*cells)*241/100+3];
+ value_size = sprintf(number, "%d", *cells);
// Append each number character
for (j = 0; j < value_size; j++) {
tape[tape_idx++] = number[j]; |
I could finally reproduce that on |
Hi @rdebath, do you want to open a PR on this change you made on the BTW, i am trying to run on |
I could narrow down this problem. The problem is on the module, not on the engine |
Happens with v1.0 and master.
The text was updated successfully, but these errors were encountered: