How to track down a bad llvm optimization pass

Joakim via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Wed Jun 29 01:18:46 PDT 2016


On Wednesday, 22 June 2016 at 16:06:13 UTC, Dan Olson wrote:
> Joakim <dlang at joakim.fea.st> writes:
>> shift.d(5): Error: shift by -4 is outside the range 0..31
>
> Agree, should be explored more to understand why that error 
> message didn't appear in this case.

I looked into this and it appears that dmd doesn't do the static 
analysis necessary to catch such bugs nor insert the runtime 
checks that could bail out with an exact error:

https://issues.dlang.org/show_bug.cgi?id=7604
https://issues.dlang.org/show_bug.cgi?id=4835

Walter says he doesn't want runtime checks for performance 
reasons (comment 11 in the second linked bug), which is 
understandable.  I'm not sure we can do anything but be more 
careful about such bugs in our D code.

I've filed a dmd bug for the unrelated optimization issue I ran 
into above:

https://issues.dlang.org/show_bug.cgi?id=16217


More information about the digitalmars-d-ldc mailing list