Frustrated with dmd codegen bug
jmh530
john.michael.hall at gmail.com
Tue Apr 24 19:45:43 UTC 2018
On Tuesday, 24 April 2018 at 18:53:02 UTC, H. S. Teoh wrote:
> [snip]
That's definitely weird. Problem seems to go away with a static
array. Seems somehow related to impl[0]. Re-writing that as
*impl.ptr and breaking apart some of the logic might help narrow
down the issue.
bool method(int v)
{
int wordIdx = v >> 6;
int bitIdx = v & 0b00111111;
func();
if (impl.length < wordIdx)
{
import std.stdio : writeln;
auto temp1 = (1UL << bitIdx);
writeln(1UL << bitIdx); //testing with v=200, prints 256
writeln(*impl.ptr & 256); //prints 0
auto temp2 = (*impl.ptr & temp1); //program killed
//writeln(*impl.ptr & 256); //if uncommented, program not
killed
return temp2 != 0;
}
else
{
return false;
}
}
More information about the Digitalmars-d
mailing list