I have looked into this bug and reduced it to this:
int main() {
int x = 0;
void test() {
void test2() {
x = 1; //Segfault because &x = 0x0
}
test2();
}
test();
return 0;
}
Somehow gdc-2.4 comepiles the test function to
movq -24(%rbp), %rax
movq %rax, -16(%rbp)
movq %rdi, -24(%rbp)
movq -24(%rbp), %rax
When it should be (as compiled with gdc-4.1)
movq %rdi, %rax
movq %rax, -16(%rbp)
This makes %rax corect for test() but it sends the value -24(%rbp) to test2()
I hope someone with more tecnical insight into gdc can fix this bug
In the meantime you can use gdc-4.1 by default by running $sudo ln -s /usr/bin/gdc-4.1 /usr/bin/gdc
I have looked into this bug and reduced it to this:
int main() {
int x = 0;
void test() {
void test2() {
x = 1; //Segfault because &x = 0x0
}
test2();
}
test();
return 0;
}
Somehow gdc-2.4 comepiles the test function to
movq -24(%rbp), %rax
movq %rax, -16(%rbp)
movq %rdi, -24(%rbp)
movq -24(%rbp), %rax
When it should be (as compiled with gdc-4.1)
movq %rdi, %rax
movq %rax, -16(%rbp)
This makes %rax corect for test() but it sends the value -24(%rbp) to test2()
I hope someone with more tecnical insight into gdc can fix this bug
In the meantime you can use gdc-4.1 by default by running $sudo ln -s /usr/bin/gdc-4.1 /usr/bin/gdc