Skip to content

Commit

Permalink
[NF] Call fail() when failing
Browse files Browse the repository at this point in the history
This avoids segmentation faults due to the type checking returning
types even when it fails.

Belonging to [master]:
  - OpenModelica/OMCompiler#2008
  • Loading branch information
sjoelund authored and OpenModelica-Hudson committed Nov 13, 2017
1 parent 8f80b4e commit c536259
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Compiler/NFFrontEnd/NFTypeCheck.mo
Expand Up @@ -375,6 +375,7 @@ algorithm
s2 := "' " + ty1_str + op_str + ty2_str + " '";

Error.addSourceMessage(Error.UNRESOLVABLE_TYPE, {s1, s2, msg_str}, Absyn.dummyInfo);
fail();
end try;
end checkLogicalBinaryOperation;

Expand Down Expand Up @@ -411,6 +412,7 @@ algorithm
s1 := "' " + e1_str + op_str + " '";

Error.addSourceMessage(Error.UNRESOLVABLE_TYPE, {s1, msg_str}, Absyn.dummyInfo);
fail();
end try;
end checkLogicalUnaryOperation;

Expand Down Expand Up @@ -461,6 +463,7 @@ algorithm
s2 := "' " + ty1_str + op_str + ty2_str + " '";

Error.addSourceMessage(Error.UNRESOLVABLE_TYPE, {s1, s2, msg_str}, Absyn.dummyInfo);
fail();
end try;
end checkRelationOperation;

Expand Down Expand Up @@ -2170,6 +2173,7 @@ algorithm
s1 := "' " + e1Str + Operator.symbol(inOp) + e2Str + " '";
s2 := "' " + t1Str + Operator.symbol(inOp) + t2Str + " '";
Error.addSourceMessage(Error.UNRESOLVABLE_TYPE, {s1,s2,suggestion}, Absyn.dummyInfo);
fail();
end binaryArrayOpError;

//public function getCrefType
Expand Down

0 comments on commit c536259

Please sign in to comment.