From fd8827d37929fb53503086db393ded4bec30a4c3 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Tue, 23 Oct 2012 16:50:30 +0000 Subject: [PATCH] * prevent compiler crash caused by double freeing after reporting not overloaded operator errors git-svn-id: trunk@22833 - --- .gitattributes | 1 + compiler/htypechk.pas | 3 +++ tests/test/toperatorerror.pp | 10 ++++++++++ 3 files changed, 14 insertions(+) create mode 100644 tests/test/toperatorerror.pp diff --git a/.gitattributes b/.gitattributes index bfc0b576b7..b7dccf8856 100644 --- a/.gitattributes +++ b/.gitattributes @@ -11163,6 +11163,7 @@ tests/test/toperator86.pp svneol=native#text/pascal tests/test/toperator87.pp svneol=native#text/pascal tests/test/toperator88.pp svneol=native#text/pascal tests/test/toperator9.pp svneol=native#text/pascal +tests/test/toperatorerror.pp svneol=native#text/plain tests/test/tover1.pp svneol=native#text/plain tests/test/tover2.pp svneol=native#text/plain tests/test/tover3.pp svneol=native#text/plain diff --git a/compiler/htypechk.pas b/compiler/htypechk.pas index e4bc2ac855..81aa0275f7 100644 --- a/compiler/htypechk.pas +++ b/compiler/htypechk.pas @@ -827,6 +827,7 @@ implementation CGMessage(parser_e_operator_not_overloaded); candidates.free; ppn.free; + ppn:=nil; exit; end; @@ -847,6 +848,7 @@ implementation CGMessage3(parser_e_operator_not_overloaded_3,ld.typename,arraytokeninfo[optoken].str,rd.typename); candidates.free; ppn.free; + ppn:=nil; exit; end; @@ -932,6 +934,7 @@ implementation if (cand_cnt=0) and (optoken=_NE) then begin ppn.free; + ppn:=nil; operpd:=nil; optoken:=_EQ; cand_cnt:=search_operator(optoken,true); diff --git a/tests/test/toperatorerror.pp b/tests/test/toperatorerror.pp new file mode 100644 index 0000000000..a865709ba3 --- /dev/null +++ b/tests/test/toperatorerror.pp @@ -0,0 +1,10 @@ +{ %fail } + +type + tenum=(ea); +var + p: pointer; + e: tenum; +begin + if e<>p then ; +end.