* fixed assert, the tree is now disposed in firstpass if assertions

are off.
This commit is contained in:
peter 1999-10-29 15:28:51 +00:00
parent 35516c1700
commit 00ef632f73
2 changed files with 41 additions and 24 deletions

View File

@ -872,33 +872,33 @@ implementation
case p^.inlinenumber of
in_assert_x_y:
begin
{ the node should be removed in the firstpass }
if not (cs_do_assertion in aktlocalswitches) then
internalerror(7123458);
otlabel:=truelabel;
oflabel:=falselabel;
getlabel(truelabel);
getlabel(falselabel);
secondpass(p^.left^.left);
if cs_do_assertion in aktlocalswitches then
begin
maketojumpbool(p^.left^.left);
emitlab(falselabel);
{ erroraddr }
emit_reg(A_PUSH,S_L,R_EBP);
{ lineno }
emit_const(A_PUSH,S_L,aktfilepos.line);
{ filename string }
hp:=genstringconstnode(current_module^.sourcefiles^.get_file_name(aktfilepos.fileindex));
secondpass(hp);
if codegenerror then
exit;
emitpushreferenceaddr(hp^.location.reference);
disposetree(hp);
{ push msg }
secondpass(p^.left^.right^.left);
emitpushreferenceaddr(p^.left^.right^.left^.location.reference);
{ call }
emitcall('FPC_ASSERT');
emitlab(truelabel);
end;
maketojumpbool(p^.left^.left);
emitlab(falselabel);
{ erroraddr }
emit_reg(A_PUSH,S_L,R_EBP);
{ lineno }
emit_const(A_PUSH,S_L,aktfilepos.line);
{ filename string }
hp:=genstringconstnode(current_module^.sourcefiles^.get_file_name(aktfilepos.fileindex));
secondpass(hp);
if codegenerror then
exit;
emitpushreferenceaddr(hp^.location.reference);
disposetree(hp);
{ push msg }
secondpass(p^.left^.right^.left);
emitpushreferenceaddr(p^.left^.right^.left^.location.reference);
{ call }
emitcall('FPC_ASSERT');
emitlab(truelabel);
freelabel(truelabel);
freelabel(falselabel);
truelabel:=otlabel;
@ -1426,7 +1426,11 @@ implementation
end.
{
$Log$
Revision 1.75 1999-10-26 12:30:40 peter
Revision 1.76 1999-10-29 15:28:51 peter
* fixed assert, the tree is now disposed in firstpass if assertions
are off.
Revision 1.75 1999/10/26 12:30:40 peter
* const parameter is now checked
* better and generic check if a node can be used for assigning
* export fixes

View File

@ -1243,6 +1243,15 @@ implementation
end
else
CGMessage(type_e_mismatch);
{ We've checked the whole statement for correctness, now we
can remove it if assertions are off }
if not(cs_do_assertion in aktlocalswitches) then
begin
disposetree(p^.left);
putnode(p);
{ we need a valid node, so insert a nothingn }
p:=genzeronode(nothingn);
end;
end;
else
@ -1260,7 +1269,11 @@ implementation
end.
{
$Log$
Revision 1.56 1999-10-26 12:30:46 peter
Revision 1.57 1999-10-29 15:28:51 peter
* fixed assert, the tree is now disposed in firstpass if assertions
are off.
Revision 1.56 1999/10/26 12:30:46 peter
* const parameter is now checked
* better and generic check if a node can be used for assigning
* export fixes