www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5417] New: Integer operations promote too much

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5417

           Summary: Integer operations promote too much
           Product: D
           Version: D2
          Platform: All
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: eatingstaples gmail.com



Created an attachment (id=861)
Code with integer promotion

When summing two shorts, they should not be both promoted to int, especially
since this reduces the ability to pack things in registers.

I've attached code which demonstrates summing two shorts as they are both
promoted to int. The code will not build, with an error explaining that both
parameters have been promoted, leading to the expression being of type int
rather than short.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 05 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5417


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |INVALID



18:42:07 PST ---
This behavior matches C integral promotion rules, which is by design, to make
it easy for C programs and programmers to transition to D.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 05 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5417


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei metalanguage.com



06:49:30 PST ---
I'll leave this resolved, but in this case two shorts are summed that are known
statically to be zero. Value range propagation should allow the implicit cast
back to short.

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