mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-24 09:02:29 +02:00
compiler: fix assembler constant expressions evaluation + fully enable appropriate test
git-svn-id: trunk@14475 -
This commit is contained in:
parent
3fff90de80
commit
56bd6e830e
@ -378,12 +378,14 @@ begin
|
|||||||
Case _Operator OF
|
Case _Operator OF
|
||||||
'(' :
|
'(' :
|
||||||
Priority:=0;
|
Priority:=0;
|
||||||
'+', '-' :
|
'|','^','~' : // the lowest priority: OR, XOR, NOT
|
||||||
Priority:=1;
|
|
||||||
'*', '/','%','<','>' :
|
|
||||||
Priority:=2;
|
|
||||||
'|','&','^','~' :
|
|
||||||
Priority:=0;
|
Priority:=0;
|
||||||
|
'&' : // bigger priority: AND
|
||||||
|
Priority:=1;
|
||||||
|
'+', '-' : // bigger priority: +, -
|
||||||
|
Priority:=2;
|
||||||
|
'*', '/','%','<','>' : // the highest priority: *, /, MOD, SHL, SHR
|
||||||
|
Priority:=3;
|
||||||
else
|
else
|
||||||
Message(asmr_e_expr_illegal);
|
Message(asmr_e_expr_illegal);
|
||||||
end;
|
end;
|
||||||
@ -440,7 +442,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
{ if start of expression then surely a prefix }
|
{ if start of expression then surely a prefix }
|
||||||
{ or if previous char was also an operator }
|
{ or if previous char was also an operator }
|
||||||
if (I = 1) or (not (Expr[I-1] in ['0'..'9','(',')'])) then
|
if (I = 1) or (not (Expr[I-1] in ['0'..'9',')'])) then
|
||||||
OpPush(Expr[I],true)
|
OpPush(Expr[I],true)
|
||||||
else
|
else
|
||||||
Begin
|
Begin
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
function Expression1: Integer;
|
function Expression1: Integer;
|
||||||
asm
|
asm
|
||||||
// mov eax, 4 * 3 - 2 + (-1) / 2
|
mov eax, 4 * 3 - 2 + (-1) / 2
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function Expression2: Integer;
|
function Expression2: Integer;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user