Re: CTFE difference between dmd and ldc2
On Saturday, 7 January 2017 at 22:55:55 UTC, Joseph Rushton Wakeling wrote: I should probably also create a formal issue for this. Any thoughts on how best to break it down into a minimal example? It does not appear easy to do so at first glance :-\ Turned out to be easier than I anticipated. It was not a CTFE problem but one of default initialization of struct fields: https://issues.dlang.org/show_bug.cgi?id=17073 In short, `void` default initialization seems to take priority with dmd regardless of anything else.
Re: CTFE difference between dmd and ldc2
On Thursday, 29 December 2016 at 09:57:25 UTC, Joseph Rushton Wakeling wrote: On Thursday, 29 December 2016 at 09:24:23 UTC, Joseph Rushton Wakeling wrote: Sorry for delay in following up on this. Yes, the same problem occurs with dmd 2.071 (as installed from the deb package downloaded from dlang.org). Specifically, I tested with 2.071.2, which I understand is the exact same frontend version as LDC 1.1.0-beta6. So, looks like the issue could be backend-related? Just to re-raise the issue: it's a blocker for what would otherwise be quite a nice and useful PR for Phobos: https://github.com/dlang/phobos/pull/5011 Assuming a fix is not on the cards any time soon, if anyone could suggest an alternative way to achieve the desired result, I'd be very grateful. I should probably also create a formal issue for this. Any thoughts on how best to break it down into a minimal example? It does not appear easy to do so at first glance :-\
Re: CTFE difference between dmd and ldc2
On Thursday, 29 December 2016 at 09:24:23 UTC, Joseph Rushton Wakeling wrote: On Tuesday, 27 December 2016 at 22:34:50 UTC, Johan Engelen wrote: Do you see the same with dmd 2.071? (that's the same front-end code as the LDC version tested) Sorry for delay in following up on this. Yes, the same problem occurs with dmd 2.071 (as installed from the deb package downloaded from dlang.org). Specifically, I tested with 2.071.2, which I understand is the exact same frontend version as LDC 1.1.0-beta6. So, looks like the issue could be backend-related?
Re: CTFE difference between dmd and ldc2
On Tuesday, 27 December 2016 at 22:34:50 UTC, Johan Engelen wrote: On Tuesday, 27 December 2016 at 17:56:07 UTC, Stefan Koch wrote: I doubt that this is a CTFE bug since there should be little difference in the ctfe code between ldc and dmd. That said, it is of course a possibility. Do you see the same with dmd 2.071? (that's the same front-end code as the LDC version tested) Sorry for delay in following up on this. Yes, the same problem occurs with dmd 2.071 (as installed from the deb package downloaded from dlang.org).
Re: CTFE difference between dmd and ldc2
On Tuesday, 27 December 2016 at 17:56:07 UTC, Stefan Koch wrote: On Tuesday, 27 December 2016 at 17:50:15 UTC, Joseph Rushton Wakeling wrote: Hello all, [ ... ] Can anyone advise what could be going wrong here? This looks like a nasty CTFE bug to me :-( Thanks & best wishes, -- Joe I doubt that this is a CTFE bug since there should be little difference in the ctfe code between ldc and dmd. That said, it is of course a possibility. Do you see the same with dmd 2.071? (that's the same front-end code as the LDC version tested) -Johan
Re: CTFE difference between dmd and ldc2
On Tuesday, 27 December 2016 at 17:56:07 UTC, Stefan Koch wrote: I doubt that this is a CTFE bug since there should be little difference in the ctfe code between ldc and dmd. That said, it is of course a possibility. I'll have a look. Thanks! It's very weird how, of the values in the `state` variable, one winds up being set correctly and the others are all zero. That might suggest that the `state` variable _is_ being set correctly and then something else is happening that zeroes out most of the values ... ?
Re: CTFE difference between dmd and ldc2
On Tuesday, 27 December 2016 at 17:50:15 UTC, Joseph Rushton Wakeling wrote: Hello all, [ ... ] Can anyone advise what could be going wrong here? This looks like a nasty CTFE bug to me :-( Thanks & best wishes, -- Joe I doubt that this is a CTFE bug since there should be little difference in the ctfe code between ldc and dmd. That said, it is of course a possibility. I'll have a look.