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

           Summary: Regression (2.057): Hex Literals are no longer treated
                    as unsigned.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: flybo...@gmail.com


--- Comment #0 from Adam Wilson <flybo...@gmail.com> 2012-02-01 22:43:21 PST ---
I have taken this example code from druntime as that is what I was compiling
for testing the new DI generation code. The only way to get bitop.d to compile
using the GIT latest DMD was to add cast(uint) in front of every hex literal in
the popcnt() function.

//BROKEN popcnt function
int popcnt( uint x )
{
    x = x - ((x>>1) & 0x5555_5555);
    x = ((x&0xCCCC_CCCC)>>2) + (x&0x3333_3333);
    x += (x>>4);
    x &= 0x0F0F_0F0F;
    x += (x>>8);
    x &= 0x00FF_00FF;
    x += (x>>16);
    x &= 0xFFFF;
    return x;
}
//FIXED popcnt function
int popcnt( uint x )
{
    x = x - ((x>>1) & cast(uint)0x5555_5555);
    x = ((x&cast(uint)0xCCCC_CCCC)>>2) + (x&cast(uint)0x3333_3333);
    x += (x>>4);
    x &= cast(uint)0x0F0F_0F0F;
    x += (x>>8);
    x &= cast(uint)0x00FF_00FF;
    x += (x>>16);
    x &= cast(uint)0xFFFF;
    return x;
}

Here is the full error dump from DMD:
typeMerge() x >> 1 op 1431655765
001E1E04 & type=null e1=001E1DBC e2=001E1DE0
  001E1DBC >> type=uint e1=023E3244 e2=001E1D98
    023E3244 var var=x type=uint
    001E1D98 1 type=int
  001E1DE0 1431655765 type=int
        t1 = uint
        t2 = int
assert cast.c(2082) t1->ty == t2->ty

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

Reply via email to