Fix shift corner-case, bug 774.

This commit is contained in:
Wilson Snyder 2014-06-10 19:13:55 -04:00
parent 475e4207cc
commit e77b7427b4
3 changed files with 11 additions and 5 deletions

View File

@ -21,7 +21,7 @@ indicates the contributor was also the author of the fix; Thanks!
**** Fix pattern assignment to conditionals, bug769. [Jie Xu]
**** Fix shift corner-cases, bug765, bug766, bug768, bug772, bug776. [Clifford Wolf]
**** Fix shift corner-cases, bug765, bug766, bug768, bug772, bug774, bug776. [Clifford Wolf]
**** Fix C compiler interpreting signing, bug773. [Clifford Wolf]

View File

@ -448,8 +448,8 @@ private:
AstNode* newp = new AstShiftR (nodep->fileline(),
fromp,
dropCondBound(lsbp),
nodep->width());
newp->dtypeFrom(nodep);
fromp->width()); // {large}>>32 requires 64-bit shift operation; then cast
newp->dtypeFrom(fromp);
if (!nodep->isQuad() && fromp->isQuad()) {
newp = new AstCCast (newp->fileline(), newp, nodep);
}

View File

@ -147,11 +147,17 @@
`endif
// bug773
w5_u = `c(31, "31");
w5_u = `c(31, 31);
w5_s = w5_u >> ((w5_u ? 1 : 2) << w5_u);
`checkh(w5_s, 5'b0);
//bug776
// bug774
w4_u = `c(4, 5);
w6_u = `c(6, 35);
w4_u = 64'd0 | (w4_u << w6_u);
`checkh(w4_u, 0);
// bug776
w4_u = `c(4, 1);
w4_u = (w4_u >> w4_u) ^~ (w4_u >> w4_u);
`checkh(w4_u, 4'b1111);