瀏覽代碼

* don't crash in {$x-} mode if a call cannot be resolved due to an error
in the expression (mantis #17455)

git-svn-id: trunk@16061 -

Jonas Maebe 15 年之前
父節點
當前提交
bd0567563c
共有 3 個文件被更改,包括 15 次插入0 次删除
  1. 1 0
      .gitattributes
  2. 2 0
      compiler/pstatmnt.pas
  3. 12 0
      tests/webtbf/tw17455.pp

+ 1 - 0
.gitattributes

@@ -9940,6 +9940,7 @@ tests/webtbf/tw1633.pp svneol=native#text/plain
 tests/webtbf/tw1642.pp svneol=native#text/plain
 tests/webtbf/tw1655.pp svneol=native#text/plain
 tests/webtbf/tw1681.pp svneol=native#text/plain
+tests/webtbf/tw17455.pp svneol=native#text/plain
 tests/webtbf/tw1754.pp svneol=native#text/plain
 tests/webtbf/tw1754b.pp svneol=native#text/plain
 tests/webtbf/tw1782.pp svneol=native#text/plain

+ 2 - 0
compiler/pstatmnt.pas

@@ -1207,6 +1207,8 @@ implementation
                  { in $x- state, the function result must not be ignored }
                  if not(cs_extsyntax in current_settings.moduleswitches) and
                     not(is_void(p.resultdef)) and
+                    { can be nil in case there was an error in the expression }
+                    assigned(tcallnode(p).procdefinition) and
                     not((tcallnode(p).procdefinition.proctypeoption=potype_constructor) and
                         assigned(tprocdef(tcallnode(p).procdefinition)._class) and
                         is_object(tprocdef(tcallnode(p).procdefinition)._class)) then

+ 12 - 0
tests/webtbf/tw17455.pp

@@ -0,0 +1,12 @@
+{ %fail }
+
+{$mode macpas}
+{$extendedsyntax off}
+
+program crash;
+var
+  thePStr: string[ 255];
+begin
+  System.Move
+    ( thePStr, MenuPtr^, Length( thePStr) + 1)
+end.