Fix bug where certain integer constant expressions would have type signed long when they should have type unsigned long.

This affected binary or unary expressions with constant operands, at least one of which was of type unsigned long.

The following test case demonstrates the problem:

#include <stdio.h>
int main (void)
{
        if (0 + 0x80000000ul < 0) puts("error 1");
        if (~0ul < 0) puts("error 2");
}
This commit is contained in:
Stephen Heumann 2016-11-05 00:07:02 -05:00
parent b8c1ea753f
commit 26a800e667

View File

@ -910,11 +910,9 @@ var
end {else if}
else if token.kind = longconst then begin
IntVal := token.lval;
ekind := longconst;
end {else if}
else begin
IntVal := token.lval;
ekind := longconst;
unsigned := true;
end; {else}
end; {IntVal}