5564 – [64-bit] loading of wrong constant byte value

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5564 - [64-bit] loading of wrong constant byte value
Summary: [64-bit] loading of wrong constant byte value
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 FreeBSD
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
Reported: 2011年02月11日 18:36 UTC by Martin Nowak
Modified: 2011年02月13日 19:39 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Martin Nowak 2011年02月11日 18:36:08 UTC
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.


AltStyle によって変換されたページ (->オリジナル) /