Oddness with C binding

2012-05-02 Thread James Miller
I'm writing bindings to XCB right now, and its mostly going 
smoothly. However I have encountered a very strange problem.


This bit of code segfaults with DMD:

auto connection = xcb_connect(null, null);

auto setup = xcb_get_setup(connection);
auto iter = xcb_setup_roots_iterator(setup);

auto screen = iter.data;

But it doesn't segfault with LDC2. This is odd to me because as 
far as I am aware LDC2 uses the same front end at DMD. This must 
mean that there is a bug in the dmd backend.


I thought it could be related to const optimizations, but I 
removed all the const declarations from the appropriate C 
bindings and the same thing happened.


I don't have the time to create a minimal test case for this, so 
I can't really file a bug report on it. I was also wondering what 
could cause this problem. I am using dmd 2.059 and the latest ldc 
from the arch repositories.


--
James Miller


Re: Oddness with C binding

2012-05-02 Thread Don Clugston

On 03/05/12 06:28, James Miller wrote:

I'm writing bindings to XCB right now, and its mostly going smoothly.
However I have encountered a very strange problem.

This bit of code segfaults with DMD:

auto connection = xcb_connect(null, null);

auto setup = xcb_get_setup(connection);
auto iter = xcb_setup_roots_iterator(setup);

auto screen = iter.data;

But it doesn't segfault with LDC2. This is odd to me because as far as I
am aware LDC2 uses the same front end at DMD. This must mean that there
is a bug in the dmd backend.

I thought it could be related to const optimizations, but I removed all
the const declarations from the appropriate C bindings and the same
thing happened.

I don't have the time to create a minimal test case for this, so I can't
really file a bug report on it. I was also wondering what could cause
this problem. I am using dmd 2.059 and the latest ldc from the arch
repositories.

--
James Miller


The infamous bug 5570?


Re: Oddness with C binding

2012-05-03 Thread Shahid
I was blocked by Issue 5570 (DMD64), here was the progress I made before 
giving up https://gist.github.com/1131642