diff options
author | joost <joost@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2008-11-17 17:34:50 +0000 |
---|---|---|
committer | joost <joost@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2008-11-17 17:34:50 +0000 |
commit | 4aa9092508eb484ab5de49b25a5f46db5238e898 (patch) | |
tree | 61efd819e9a61987ca8771e4ad03e8a67fb1dce4 | |
parent | b9aeb29da9dbc94f27081e731c3babb3c061e9e9 (diff) | |
download | fpc-4aa9092508eb484ab5de49b25a5f46db5238e898.tar.gz |
Merged revisions 11596,11619,11621-11622,11628,11664-11667,11670,11672,11683,11685,11689-11692,11694-11696,11698,11701-11702,11705-11707,11712-11718,11723-11726,11728-11729,11733-11737,11773 via svnmerge from
svn+ssh://joost@svn.freepascal.org/FPC/svn/fpc/trunk
........
r11596 | jonas | 2008-08-16 22:51:52 +0200 (Sat, 16 Aug 2008) | 3 lines
* Don't inline ioresult. It's not speed critical and inlining it causes
code bloat.
........
r11672 | jonas | 2008-08-31 12:07:53 +0200 (Sun, 31 Aug 2008) | 3 lines
* only set dynarray pointer to nil in decref in case the last reference
has been destroyed (mantis #12000)
........
r11773 | jonas | 2008-09-13 22:01:47 +0200 (Sat, 13 Sep 2008) | 2 lines
* set finalized dynarrays to nil (mantis #12048)
........
git-svn-id: http://svn.freepascal.org/svn/fpc/branches/fixes_2_2@12149 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r-- | rtl/inc/dynarr.inc | 6 | ||||
-rw-r--r-- | rtl/inc/rtti.inc | 5 | ||||
-rw-r--r-- | rtl/inc/system.inc | 2 | ||||
-rw-r--r-- | rtl/inc/systemh.inc | 2 | ||||
-rw-r--r-- | tests/webtbs/tw12000.pp | 33 | ||||
-rw-r--r-- | tests/webtbs/tw12048.pp | 24 |
6 files changed, 67 insertions, 5 deletions
diff --git a/rtl/inc/dynarr.inc b/rtl/inc/dynarr.inc index 8963e5f380..49bc12e6fc 100644 --- a/rtl/inc/dynarr.inc +++ b/rtl/inc/dynarr.inc @@ -106,8 +106,10 @@ procedure fpc_dynarray_decr_ref(var p : pointer;ti : pointer); [Public,Alias:'FP { decr. ref. count } { should we remove the array? } if declocked(realp^.refcount) then - fpc_dynarray_clear_internal(realp,pdynarraytypeinfo(ti)); - p := nil; + begin + fpc_dynarray_clear_internal(realp,pdynarraytypeinfo(ti)); + p := nil; + end; end; { provide local access to dynarr_decr_ref for dynarr_setlength } diff --git a/rtl/inc/rtti.inc b/rtl/inc/rtti.inc index 0382465a97..e3f6d23ed6 100644 --- a/rtl/inc/rtti.inc +++ b/rtl/inc/rtti.inc @@ -167,7 +167,10 @@ begin PPointer(Data)^:=nil; end; tkDynArray: - fpc_dynarray_decr_ref(PPointer(Data)^,TypeInfo); + begin + fpc_dynarray_decr_ref(PPointer(Data)^,TypeInfo); + PPointer(Data)^:=nil; + end; tkVariant: variant_clear(PVarData(Data)^); end; diff --git a/rtl/inc/system.inc b/rtl/inc/system.inc index cb2f5a1ffa..897d4d5929 100644 --- a/rtl/inc/system.inc +++ b/rtl/inc/system.inc @@ -624,7 +624,7 @@ begin end; -Function IOResult:Word;{$ifdef SYSTEMINLINE}inline;{$endif} +Function IOResult:Word; var HInoutRes : PWord; Begin diff --git a/rtl/inc/systemh.inc b/rtl/inc/systemh.inc index 4408088761..f0d04ba5a6 100644 --- a/rtl/inc/systemh.inc +++ b/rtl/inc/systemh.inc @@ -720,7 +720,7 @@ function get_frame:pointer;{$ifdef SYSTEMINLINE}inline;{$endif} function get_caller_addr(framebp:pointer):pointer;{$ifdef SYSTEMINLINE}inline;{$endif} function get_caller_frame(framebp:pointer):pointer;{$ifdef SYSTEMINLINE}inline;{$endif} -Function IOResult:Word;{$ifdef SYSTEMINLINE}inline;{$endif} +Function IOResult:Word; Function Sptr:Pointer;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:fpc_in_const_ptr]; {$ifdef FPC_HAS_FEATURE_PROCESSES} diff --git a/tests/webtbs/tw12000.pp b/tests/webtbs/tw12000.pp new file mode 100644 index 0000000000..45753255cd --- /dev/null +++ b/tests/webtbs/tw12000.pp @@ -0,0 +1,33 @@ +program arcrash; + +{$mode objfpc}{$H+} + +type + Trec = record + Signature: array of Integer; + s: ansistring; + end; + +var + M: array of Trec; + s2: ansistring; + +begin + SetLength(M,2); + SetLength(M[0].Signature,4); + SetLength(M[1].Signature,4); + setlength(m[0].s,2); + s2:=m[0].s; + WriteLn(Length(M[0].Signature), ' ', Length(M[1].Signature)); + writeln(length(m[0].s)); + M[0].Signature := M[0].Signature; + m[0].s:=m[0].s; + WriteLn(Length(M[0].Signature), ' ', Length(M[1].Signature)); + writeln(length(m[0].s)); + s2:=''; + if (Length(M[0].Signature) <> 4) then + halt(1); + if (Length(M[0].s) <> 2) then + halt(2); +end. + diff --git a/tests/webtbs/tw12048.pp b/tests/webtbs/tw12048.pp new file mode 100644 index 0000000000..d2dfe3a7f3 --- /dev/null +++ b/tests/webtbs/tw12048.pp @@ -0,0 +1,24 @@ +{ %opt=-gh } + +{$mode objfpc} + +program DynArrBug; + +uses Types; + +function GetDynArray: TStringDynArray; +begin + SetLength( GetDynArray, 16 ); +end; + +var + darr: array[1..1] of TStringDynArray; +begin + keepreleased:=true; + darr[1] := GetDynArray(); + Finalize( darr[1] ); + if pointer(darr[1])<>nil then + halt(1); + darr[1] := GetDynArray(); +end. + |