[Issue 550] Shifting by more bits than size of quantity is allowed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 3 01:36:36 PST 2006


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


deewiant at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P4                          |P3




------- Comment #2 from deewiant at gmail.com  2006-12-03 03:36 -------
Only partially fixed in DMD 0.176. Stepping up the priority since compiler
behaviour is now inconsistent.

void main() {
        int c;
        c = c << 33; // Error: shift left by 33 exceeds 32
}

void main() {
        int c;
        c = c >> 33; // Works, shouldn't
}

void main() {
        int c;
        c <<= 33; // Works, shouldn't
}

void main() {
        int c;
        c >>= 33; // Works, shouldn't
}

void main() {
        int c;
        c = c >>> 33; // Works, shouldn't
}

void main() {
        int c;
        c >>>= 33; // Works, shouldn't
}

Also, this error message seems a bit strange:

void main() {
        int c;
        c = c << -1; // Error: shift left by -1 exceeds 32
}


-- 




More information about the Digitalmars-d-bugs mailing list