Summary: Optimizer bug results in false if condition being
--- Comment #0 from Janzert <janz...@janzert.com> 2009-11-29 05:28:04 PST ---
I've been chasing a bug for a few days and finally have it narrowed down to the
following example. Basically a condition that should evaluate to false is taken
The printf line below should never be executed, but it is if compiled under
linux with "dmd -release -O -inline badbranch.d".
I first started chasing this while using 1.043 but have since upgraded to 1.052
and still see it. Not surprisingly I also see it with phobos or tango. It has
also been reported to behave the same with 2.034.
extern(C) int printf(char*, ...);
ulong bits = [0UL, 1];
int called(ulong value)
value = value * 3;
int test(Container* c, int shift)
int count = 0;
count = 1;
count |= called(c.bits) << shift;
// This is always false, but is taken anyway.
printf("Impossible output %lld\n", c.bits);
int main(char args)
int shift = ;
return test(&c, shift);
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------