www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1601] New: shr and shl error message is missing line numbers

reply d-bugmail puremagic.com writes:
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


-- 
Oct 20 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1601






-------
Don't forget about UShr:

void main() {
    int i;

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


-- 
Oct 20 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1601


braddr puremagic.com changed:

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





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


-- 
Oct 20 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1601


clugdbug yahoo.com.au changed:

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





Fixed DMD1.032


-- 
Jul 09 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1601






Fixed dmd 1.032 and 2.016


-- 
Jul 09 2008