mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-03 10:29:41 +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,11 +1278,15 @@ var
|
||||
ival := ival | $FF00;
|
||||
end; {with}
|
||||
end {if}
|
||||
else if baseType in [cgUByte,cgUWord] then begin
|
||||
else if baseType = cgUWord then begin
|
||||
op^.token.kind := uintConst;
|
||||
op^.token.class := intConstant;
|
||||
op^.token.ival := long(op1).lsw;
|
||||
if baseType = cgUByte then
|
||||
end {else if}
|
||||
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}
|
||||
else if baseType = cgLong then begin
|
||||
|
Loading…
Reference in New Issue
Block a user