[Issue 3583] Regression(DMD2.037): Unsigned right shift works the same as signed right shift.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 30 12:06:32 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3583


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #3 from Don <clugdbug at yahoo.com.au> 2009-12-30 12:06:31 PST ---
Root cause: A bad refactoring that dropped the conversion to unsigned.

PATCH: e2ir.c, line 3008 and 3113 UshrExp::toElem() and UshrAssignExp::toElem()
Copy the code from D1.

elem *UshrAssignExp::toElem(IRState *irs)
{
-    return toElemBin(irs, OPshrass);
+    elem *eleft  = e1->toElem(irs);
+    eleft->Ety = touns(eleft->Ety);
+    elem *eright = e2->toElem(irs);
+    elem *e = el_bin(OPshrass, type->totym(), eleft, eright);
+    el_setLoc(e, loc);
+    return e;
}

elem *UshrExp::toElem(IRState *irs)
{
-    return toElemBin(irs, OPshr);
+    elem *eleft  = e1->toElem(irs);
+    eleft->Ety = touns(eleft->Ety);
+    elem *eright = e2->toElem(irs);
+    elem *e = el_bin(OPshr, type->totym(), eleft, eright);
+    el_setLoc(e, loc);
+    return e;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list