Thread overview
[Issue 1601] New: shr and shl error message is missing line numbers
Oct 20, 2007
d-bugmail
Oct 20, 2007
d-bugmail
Oct 20, 2007
d-bugmail
Jul 09, 2008
d-bugmail
Jul 10, 2008
d-bugmail
October 20, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1601

           Summary: shr and shl error message is missing line numbers
           Product: D
           Version: 1.022
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: braddr@puremagic.com


Continued from bug 550, the error for out of range shifting is present now, but lacks line numbers for Shl and Shr, but ShrAssign and ShlAssign are in good shape.  The test code:

void main()
{
    int i = 0;

    i >>= 33;
    i <<= 33;
    i = i >> 33;
    i = i << 33;
}

the results:
/home/braddr/sandbox/d/bugs/550/bug550.d(5): Error: shift assign by 33 is
outside the range 0..32
/home/braddr/sandbox/d/bugs/550/bug550.d(6): Error: shift assign by 33 is
outside the range 0..32
Error: shift by 33 is outside the range 0..32


-- 

October 20, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1601





------- Comment #1 from matti.niemenmaa+dbugzilla@iki.fi  2007-10-20 03:32 -------
Don't forget about UShr:

void main() {
    int i;

    i >>= 33;
    i <<= 33;
    i >>>= 33;
    i = i >> 33;
    i = i << 33;
    i = i >>> 33;
}


-- 

October 20, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1601


braddr@puremagic.com changed:

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




------- Comment #2 from braddr@puremagic.com  2007-10-20 05:13 -------
The fix (tested with gdc which exhibits exactly the same bug):

--- optimize.c  2007-10-20 03:11:39.000000000 -0700
+++ optimize.c.orig     2007-10-20 03:12:10.000000000 -0700
@@ -473,7 +473,7 @@
        integer_t i2 = e->e2->toInteger();
        d_uns64 sz = e->e1->type->size() * 8;
        if (i2 < 0 || i2 > sz)
-       {   e->error("shift by %jd is outside the range 0..%zu", i2, sz);
+       {   error("shift by %jd is outside the range 0..%zu", i2, sz);
            e->e2 = new IntegerExp(0);
        }
        if (e->e1->isConst() == 1)

The new ouput, with Matti's version of the code:
bug550.d:4: Error: shift assign by 33 is outside the range 0..32
bug550.d:5: Error: shift assign by 33 is outside the range 0..32
bug550.d:6: Error: shift assign by 33 is outside the range 0..32
bug550.d:7: Error: shift left by 33 exceeds 32
bug550.d:8: Error: shift left by 33 exceeds 32
bug550.d:9: Error: shift left by 33 exceeds 32


-- 

July 09, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1601


clugdbug@yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #3 from clugdbug@yahoo.com.au  2008-07-09 07:12 -------
Fixed DMD1.032


-- 

July 10, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1601





------- Comment #4 from bugzilla@digitalmars.com  2008-07-09 22:40 -------
Fixed dmd 1.032 and 2.016


--