diff --git a/.gitattributes b/.gitattributes index fd9ab355bb..7eb412e5ef 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6003,6 +6003,7 @@ tests/tbs/tb0501.pp svneol=native#text/plain tests/tbs/tb0502.pp svneol=native#text/plain tests/tbs/tb0503.pp svneol=native#text/plain tests/tbs/tb0504.pp svneol=native#text/plain +tests/tbs/tb0505.pp svneol=native#text/plain tests/tbs/ub0060.pp svneol=native#text/plain tests/tbs/ub0069.pp svneol=native#text/plain tests/tbs/ub0119.pp svneol=native#text/plain diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index e1cec53174..f0b9d340bf 100644 --- a/compiler/pexpr.pas +++ b/compiler/pexpr.pas @@ -2120,7 +2120,10 @@ implementation _RETURN : begin consume(_RETURN); - p1 := cexitnode.create(comp_expr(true)); + if not(token in [_SEMICOLON,_ELSE,_END]) then + p1 := cexitnode.create(comp_expr(true)) + else + p1 := cexitnode.create(nil); end; _INHERITED : begin diff --git a/tests/tbs/tb0505.pp b/tests/tbs/tb0505.pp new file mode 100644 index 0000000000..db802bf21d --- /dev/null +++ b/tests/tbs/tb0505.pp @@ -0,0 +1,10 @@ +{$mode macpas} + +procedure test; +begin + return; +end; + +begin + test; +end.