Skip to content

Commit

Permalink
bytecode: In Classify, move Release before changing type
Browse files Browse the repository at this point in the history
Release only works if it knows the actual type and has the right pointer

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
  • Loading branch information
c3d committed Jul 1, 2021
1 parent eb2a4ba commit 2230836
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/bytecode.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ MACHINE_TYPE(natural, unsigned long, naught)
case NATURAL:
{
Natural *xn = (Natural *) tree;
Release(xn);
if (xn->IsSigned())
{
type = integer_mtype;
Expand All @@ -455,20 +456,20 @@ MACHINE_TYPE(natural, unsigned long, naught)
type = natural_mtype;
as_natural = xn->value;
}
Release(xn);
return *this;
}
case REAL:
{
Real *xr = (Real *) tree;
Release(xr);
type = real_mtype;
as_real = xr->value;
Release(xr);
return *this;
}
case TEXT:
{
Text *xt = (Text *) tree;
Release(xt);
if (xt->IsCharacter())
{
type = character_mtype;
Expand All @@ -479,7 +480,6 @@ MACHINE_TYPE(natural, unsigned long, naught)
type = text_mtype;
as_text = new text(xt->value);
}
Release(xt);
return *this;
}
case NAME:
Expand Down

0 comments on commit 2230836

Please sign in to comment.