Re: [commit: ghc] master: Fix linked list manipulation code (buggy on consecutive deletion) (e3938f3)

Thanks Edward. Austin, can you cherry-pick this for 7.8.3 please? Cheers, Simon On 13/04/2014 07:37, git@git.haskell.org wrote:
Repository : ssh://git@git.haskell.org/ghc
On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e3938f3adac0093b23694fd347774244ce...
---------------------------------------------------------------
commit e3938f3adac0093b23694fd347774244ce121478 Author: Edward Z. Yang
Date: Sat Apr 12 23:02:13 2014 -0700 Fix linked list manipulation code (buggy on consecutive deletion)
Signed-off-by: Edward Z. Yang
---------------------------------------------------------------
e3938f3adac0093b23694fd347774244ce121478 rts/CheckUnload.c | 3 ++- rts/Linker.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/rts/CheckUnload.c b/rts/CheckUnload.c index f1f454c..98f184b 100644 --- a/rts/CheckUnload.c +++ b/rts/CheckUnload.c @@ -298,7 +298,7 @@ void checkUnload (StgClosure *static_objects) // marked as unreferenced can be physically unloaded, because we // have no references to it. prev = NULL; - for (oc = unloaded_objects; oc; prev = oc, oc = next) { + for (oc = unloaded_objects; oc; oc = next) { next = oc->next; if (oc->referenced == 0) { if (prev == NULL) { @@ -312,6 +312,7 @@ void checkUnload (StgClosure *static_objects) } else { IF_DEBUG(linker, debugBelch("Object file still in use: %" PATH_FMT "\n", oc->fileName)); + prev = oc; } }
diff --git a/rts/Linker.c b/rts/Linker.c index af26d74..ab235e9 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -3016,8 +3016,8 @@ unloadObj( pathchar *path ) IF_DEBUG(linker, debugBelch("unloadObj: %" PATH_FMT "\n", path));
prev = NULL; - for (oc = objects; oc; prev = oc, oc = next) { - next = oc->next; + for (oc = objects; oc; oc = next) { + next = oc->next; // oc might be freed
if (!pathcmp(oc->fileName,path)) {
@@ -3075,6 +3075,8 @@ unloadObj( pathchar *path ) /* This could be a member of an archive so continue * unloading other members. */ unloadedAnyObj = HS_BOOL_TRUE; + } else { + prev = oc; } }
_______________________________________________ ghc-commits mailing list ghc-commits@haskell.org http://www.haskell.org/mailman/listinfo/ghc-commits
participants (1)
-
Simon Marlow