Permalink
Browse files

Issue 6354 - Optimizer bug on x86_64: Bitshift optimized out when for…

…each and scope(failure) are used
  • Loading branch information...
WalterBright committed Nov 30, 2011
1 parent e806c9d commit 062351c39c6337eb09338a209d8e945c489852de
Showing with 17 additions and 1 deletion.
  1. +1 −1 src/backend/cod4.c
  2. +16 −0 test/runnable/test42.d
View
@@ -643,7 +643,7 @@ code *cdeq(elem *e,regm_t *pretregs)
cl = getlvalue(&cs,e1,RMstore | retregs); // get lvalue (cl == CNIL if regvar)
}
c = getregs_imm(varregm);
c = getregs(varregm);
assert(!(retregs & mES && (cs.Iflags & CFSEG) == CFes));
#if TARGET_SEGMENTED
View
@@ -4485,6 +4485,21 @@ void test7026() {
}
/***************************************************/
void test6354()
{
foreach(j; 0 .. 2)
{
scope(failure) int i = 0;
ushort left = 0xffU;
left <<= (ushort.sizeof - 1) * 8;
assert((((left & 0xff00U) >> 8) | ((left & 0x00ffU) << 8)) == 0xffu);
}
}
/***************************************************/
int main()
@@ -4722,6 +4737,7 @@ int main()
test6189();
test6997();
test7026();
test6354();
writefln("Success");
return 0;

0 comments on commit 062351c

Please sign in to comment.