#dbugfix Issue 16189

Michael michael at toohuman.io
Wed Feb 7 11:37:19 UTC 2018


On Wednesday, 7 February 2018 at 08:51:01 UTC, Kirr wrote:
> https://issues.dlang.org/show_bug.cgi?id=16189
>
> This is a P1 critical DMD bug, silently generating wrong code. 
> Reported one and a half year ago, but exists in DMD compilers 
> going back to DMD 2.050 (possibly more, but this is as far back 
> as I tried).
>
> The repro is essentially C, it involves nothing but array, 
> struct and loop. No templates, CTFE, no phobos, no any fancy 
> features.
>
> I can fully understand that may be this bug is hard to fix, 
> that there's not enough manpower, that there are other more 
> pressing issues, that no one can be expected to work on 
> something they are not interested in, etc. And may I'm the only 
> one affected? (it's a mystery to me). But this bug is a 
> phychological obstacle to my use of D (or rather DMD, because 
> LDC seems OK). May be it's just my expectation that is too high.
>
> I'm not ready to give up arrays, structs or loops. I 
> experimentally worked around this once I found it, by 
> re-wording the loop. But I've no idea how to make sure this bug 
> won't hit me somewhere else. I guess I can live without 
> optimizer (or without DMD). In any case, I think that 
> miscompiling a simplest C-like loop does not send the right 
> message to a newcomer.
>
> I'll appreciate any help with this bug.

Yeah that's... really bad. I suppose the saving grace is that 
it's only a serious issue with the use of the optimiser, which I 
don't tend to use on DMD, but this should really be prioritised. 
I guess the fact that it's not a regression might make fixing it 
harder, but it doesn't really matter.

Does it work with slightly varied examples like where a = -1, and 
is incremented etc.?


More information about the Digitalmars-d mailing list