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

           Summary: Bad code gen involving ubyte, ternary operators, and
                    shifts
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Mac OS X
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: peter.alexander...@gmail.com


--- Comment #0 from Peter Alexander <peter.alexander...@gmail.com> 2012-08-02 
13:23:12 PDT ---
Sorry for the title, don't know how to describe this well:

------------------
class Foo
{
public:
    void foo(uint value)
    {
        ubyte size = value < (0x7fU << 0 ) ? 1 :
                     value < (0x7fU << 14) ? 2 :
                                             3;
        import std.stdio;
        writeln(size);
    }
}

void main()
{
    Foo f = new Foo();
    f.foo(1000000);
}
------------------

With no optimisations or any other flags, this prints out 255, even though it
should print 2.

Happens in DMD 2.060, but not 2.059.

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

Reply via email to