Menu

#2734 Missing warning on right shift by more than width of type

open
nobody
None
other
5
2018-03-30
2018-03-30
No

SDCC sometimes omits the warning on right shift by equal to or more than the width of a type.

For plain shifts, the warning is missing for signed types:

unsigned char c;
int i;

void f(void)
{
    c >>= 16; // Warning OK
    i >>= 40; // Warning missing
}

In literals it seems to be always missing:

unsigned char c;
unsigned int i;

void f(void)
{
    c = (1 >> 16);   // Warning missing
    i = (17u >> 16); // Warning missing
}

Philipp

Discussion


Log in to post a comment.

MongoDB Logo MongoDB