mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-03 10:29:41 +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}
|
||||
|
||||
begin {CompareToZero}
|
||||
if expressionType^.kind = pointerType then
|
||||
if expressionType^.kind in [pointerType,arrayType] then
|
||||
expressionType := uLongPtr;
|
||||
if expressionType^.kind = scalarType then begin
|
||||
bt := UsualUnaryConversions;
|
||||
@ -3075,7 +3075,7 @@ case tree^.token.kind of
|
||||
|
||||
barbarop: begin {||}
|
||||
GenerateCode(tree^.left);
|
||||
if expressionType^.kind = pointerType then
|
||||
if expressionType^.kind in [pointerType,arrayType] then
|
||||
expressionType := uLongPtr
|
||||
else if UsualUnaryConversions = cgExtended then begin
|
||||
GenLdcReal(0.0);
|
||||
@ -3084,7 +3084,7 @@ case tree^.token.kind of
|
||||
end; {if}
|
||||
lType := expressionType;
|
||||
GenerateCode(tree^.right);
|
||||
if expressionType^.kind = pointerType then
|
||||
if expressionType^.kind in [pointerType,arrayType] then
|
||||
expressionType := uLongPtr
|
||||
else if UsualUnaryConversions = cgExtended then begin
|
||||
GenLdcReal(0.0);
|
||||
@ -3104,7 +3104,7 @@ case tree^.token.kind of
|
||||
|
||||
andandop: begin {&&}
|
||||
GenerateCode(tree^.left);
|
||||
if expressionType^.kind = pointerType then
|
||||
if expressionType^.kind in [pointerType,arrayType] then
|
||||
expressionType := uLongPtr
|
||||
else if UsualUnaryConversions = cgExtended then begin
|
||||
GenLdcReal(0.0);
|
||||
@ -3113,7 +3113,7 @@ case tree^.token.kind of
|
||||
end; {if}
|
||||
lType := expressionType;
|
||||
GenerateCode(tree^.right);
|
||||
if expressionType^.kind = pointerType then
|
||||
if expressionType^.kind in [pointerType,arrayType] then
|
||||
expressionType := uLongPtr
|
||||
else if UsualUnaryConversions = cgExtended then begin
|
||||
GenLdcReal(0.0);
|
||||
|
Loading…
Reference in New Issue
Block a user