mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-06-03 23:29:28 +00:00
Give errors for certain invalid compound assignment expressions.
The following example shows cases that were erroneously permitted before: int main(void) { int i, *p; i *= p; i <<= 5.0; i <<= (void)1; }
This commit is contained in:
parent
5dbe632f33
commit
b1d4d8d668
|
@ -3011,11 +3011,13 @@ case tree^.token.kind of
|
||||||
kind := lType^.kind;
|
kind := lType^.kind;
|
||||||
GenerateCode(tree^.right);
|
GenerateCode(tree^.right);
|
||||||
if expressionType^.kind <> scalarType then
|
if expressionType^.kind <> scalarType then
|
||||||
if tree^.token.kind in [pluseqop,minuseqop] then
|
Error(66);
|
||||||
Error(66);
|
|
||||||
if tree^.token.kind in [gtgteqop,ltlteqop] then
|
if tree^.token.kind in [gtgteqop,ltlteqop] then
|
||||||
if kind = scalarType then
|
if kind = scalarType then
|
||||||
if expressionType^.kind = scalarType then begin
|
if expressionType^.kind = scalarType then begin
|
||||||
|
if expressionType^.baseType in
|
||||||
|
[cgReal,cgDouble,cgComp,cgExtended,cgVoid] then
|
||||||
|
Error(66);
|
||||||
et := UsualUnaryConversions;
|
et := UsualUnaryConversions;
|
||||||
if et <> Unary(ltype^.baseType) then begin
|
if et <> Unary(ltype^.baseType) then begin
|
||||||
Gen2(pc_cnv, et, ord(Unary(ltype^.baseType)));
|
Gen2(pc_cnv, et, ord(Unary(ltype^.baseType)));
|
||||||
|
|
2
cc.notes
2
cc.notes
|
@ -998,6 +998,8 @@ int foo(int[42]);
|
||||||
|
|
||||||
128. The ++ and -- operators often would not work correctly on bit-fields, or on floating-point values that were in a structure or were accessed via a pointer.
|
128. The ++ and -- operators often would not work correctly on bit-fields, or on floating-point values that were in a structure or were accessed via a pointer.
|
||||||
|
|
||||||
|
129. Certain invalid compound assignment expressions were erroneously permitted.
|
||||||
|
|
||||||
-- Bugs from C 2.1.0 that have been fixed -----------------------------------
|
-- Bugs from C 2.1.0 that have been fixed -----------------------------------
|
||||||
|
|
||||||
1. In some situations, fread() reread the first 1K or so of the file.
|
1. In some situations, fread() reread the first 1K or so of the file.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user