Bug 5564 – [64-bit] loading of wrong constant byte value
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
FreeBSD
Creation time
2011-02-11T18:36:00Z
Last change time
2011-02-13T19:39:32Z
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2011-02-11T18:36:08Z
struct Temp
{
bool value;
this(int, bool value) {
this.value = value;
}
};
enum asserting = 255; //!<- anything below 256 will assert
enum working = 256; //!<- anything above is fine
void main() {
assert(Temp(asserting, false).value == false);
}
---
In the constructor the bool is loaded from SIL which contains a non-zero value.
I wonder why movregconst at cgen.c(610):
if (r < 4 && ((regcon.immed.value[r] >> 8) & 0xFF) == value)
{ c = genregs(c,0x8A,reg,r | 4); // MOV regL,rH
goto L2;
}
is generating a MOV dh, dh before calling the constructor.