mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-18 03:29:49 +00:00
Allow arrays to be used (implicitly converted to pointers) as operands of && and ||, and the first operand of the ? : operator.
This fixes the bug in the compca02.c test case.
This commit is contained in:
parent
2d6ae52d32
commit
c4360c70a1
@ -1775,7 +1775,7 @@ var
|
|||||||
bt: baseTypeEnum; {base type of loaded value}
|
bt: baseTypeEnum; {base type of loaded value}
|
||||||
|
|
||||||
begin {CompareToZero}
|
begin {CompareToZero}
|
||||||
if expressionType^.kind = pointerType then
|
if expressionType^.kind in [pointerType,arrayType] then
|
||||||
expressionType := uLongPtr;
|
expressionType := uLongPtr;
|
||||||
if expressionType^.kind = scalarType then begin
|
if expressionType^.kind = scalarType then begin
|
||||||
bt := UsualUnaryConversions;
|
bt := UsualUnaryConversions;
|
||||||
@ -3075,7 +3075,7 @@ case tree^.token.kind of
|
|||||||
|
|
||||||
barbarop: begin {||}
|
barbarop: begin {||}
|
||||||
GenerateCode(tree^.left);
|
GenerateCode(tree^.left);
|
||||||
if expressionType^.kind = pointerType then
|
if expressionType^.kind in [pointerType,arrayType] then
|
||||||
expressionType := uLongPtr
|
expressionType := uLongPtr
|
||||||
else if UsualUnaryConversions = cgExtended then begin
|
else if UsualUnaryConversions = cgExtended then begin
|
||||||
GenLdcReal(0.0);
|
GenLdcReal(0.0);
|
||||||
@ -3084,7 +3084,7 @@ case tree^.token.kind of
|
|||||||
end; {if}
|
end; {if}
|
||||||
lType := expressionType;
|
lType := expressionType;
|
||||||
GenerateCode(tree^.right);
|
GenerateCode(tree^.right);
|
||||||
if expressionType^.kind = pointerType then
|
if expressionType^.kind in [pointerType,arrayType] then
|
||||||
expressionType := uLongPtr
|
expressionType := uLongPtr
|
||||||
else if UsualUnaryConversions = cgExtended then begin
|
else if UsualUnaryConversions = cgExtended then begin
|
||||||
GenLdcReal(0.0);
|
GenLdcReal(0.0);
|
||||||
@ -3104,7 +3104,7 @@ case tree^.token.kind of
|
|||||||
|
|
||||||
andandop: begin {&&}
|
andandop: begin {&&}
|
||||||
GenerateCode(tree^.left);
|
GenerateCode(tree^.left);
|
||||||
if expressionType^.kind = pointerType then
|
if expressionType^.kind in [pointerType,arrayType] then
|
||||||
expressionType := uLongPtr
|
expressionType := uLongPtr
|
||||||
else if UsualUnaryConversions = cgExtended then begin
|
else if UsualUnaryConversions = cgExtended then begin
|
||||||
GenLdcReal(0.0);
|
GenLdcReal(0.0);
|
||||||
@ -3113,7 +3113,7 @@ case tree^.token.kind of
|
|||||||
end; {if}
|
end; {if}
|
||||||
lType := expressionType;
|
lType := expressionType;
|
||||||
GenerateCode(tree^.right);
|
GenerateCode(tree^.right);
|
||||||
if expressionType^.kind = pointerType then
|
if expressionType^.kind in [pointerType,arrayType] then
|
||||||
expressionType := uLongPtr
|
expressionType := uLongPtr
|
||||||
else if UsualUnaryConversions = cgExtended then begin
|
else if UsualUnaryConversions = cgExtended then begin
|
||||||
GenLdcReal(0.0);
|
GenLdcReal(0.0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user