mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-02-11 22:30:49 +00:00
Treat constant expressions cast to char as promoting to int, not unsigned int.
The following program demonstrates the problem: #include <stdio.h> int main(void) { long l = (char)1 - (char)5; printf("%li\n", l); /* should print -4 */ }
This commit is contained in:
parent
cb0497687e
commit
b2785dfe0e
@ -1278,12 +1278,16 @@ var
|
|||||||
ival := ival | $FF00;
|
ival := ival | $FF00;
|
||||||
end; {with}
|
end; {with}
|
||||||
end {if}
|
end {if}
|
||||||
else if baseType in [cgUByte,cgUWord] then begin
|
else if baseType = cgUWord then begin
|
||||||
op^.token.kind := uintConst;
|
op^.token.kind := uintConst;
|
||||||
op^.token.class := intConstant;
|
op^.token.class := intConstant;
|
||||||
op^.token.ival := long(op1).lsw;
|
op^.token.ival := long(op1).lsw;
|
||||||
if baseType = cgUByte then
|
end {else if}
|
||||||
op^.token.ival := op^.token.ival & $00FF;
|
else if baseType = cgUByte then begin
|
||||||
|
op^.token.kind := intConst;
|
||||||
|
op^.token.class := intConstant;
|
||||||
|
op^.token.ival := long(op1).lsw;
|
||||||
|
op^.token.ival := op^.token.ival & $00FF;
|
||||||
end {else if}
|
end {else if}
|
||||||
else if baseType = cgLong then begin
|
else if baseType = cgLong then begin
|
||||||
op^.token.kind := longConst;
|
op^.token.kind := longConst;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user