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
** Attachment added: "$gdc -S test.d -o test.s"
http://launchpadlibrarian.net/19222647/test.s
--
D programs segfault when vararg functions are used
https://bugs.launchpad.net/bugs/235955
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs