فهرست منبع

+ correctly set var state of addr and frame in raise statements, resolves #33818

git-svn-id: trunk@39162 -
florian 7 سال پیش
والد
کامیت
3b3e33d863
3فایلهای تغییر یافته به همراه27 افزوده شده و 0 حذف شده
  1. 1 0
      .gitattributes
  2. 3 0
      compiler/nflw.pas
  3. 23 0
      tests/webtbs/tw33818.pp

+ 1 - 0
.gitattributes

@@ -16148,6 +16148,7 @@ tests/webtbs/tw3360.pp svneol=native#text/plain
 tests/webtbs/tw33635.pp svneol=native#text/pascal
 tests/webtbs/tw3364.pp svneol=native#text/plain
 tests/webtbs/tw3366.pp svneol=native#text/plain
+tests/webtbs/tw33818.pp svneol=native#text/pascal
 tests/webtbs/tw3402.pp svneol=native#text/plain
 tests/webtbs/tw3411.pp svneol=native#text/plain
 tests/webtbs/tw3418.pp svneol=native#text/plain

+ 3 - 0
compiler/nflw.pas

@@ -2169,11 +2169,14 @@ implementation
                begin
                  { addr }
                  typecheckpass(right);
+                 set_varstate(right,vs_read,[vsf_must_be_valid]);
                  inserttypeconv(right,voidcodepointertype);
+
                  { frame }
                  if assigned(third) then
                   begin
                     typecheckpass(third);
+                    set_varstate(third,vs_read,[vsf_must_be_valid]);
                     inserttypeconv(third,voidpointertype);
                   end;
                end;

+ 23 - 0
tests/webtbs/tw33818.pp

@@ -0,0 +1,23 @@
+{ %OPT=-Seh -vh }
+{ %norun }
+{$mode objfpc}
+
+program Project1;
+
+uses
+ SysUtils;
+
+procedure RaiseException(AReturnAddress : Pointer);
+begin
+ raise Exception.Create('message') at AReturnAddress;
+end;
+
+procedure RaiseException(AReturnAddress : Pointer;AFrame : Pointer);
+begin
+ raise Exception.Create('message') at AReturnAddress,AFrame;
+end;
+
+begin
+ RaiseException(Pointer(10));
+ RaiseException(Pointer(10),Pointer(1234));
+end.