diff options
author | Phuong Trinh <lolotp@fb.com> | 2019-04-25 18:44:02 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-06-13 02:48:50 -0400 |
commit | fc6b23be509e290f8d27775a1c637284a335ed81 (patch) | |
tree | e977d63250a03296011b58434034cb2c471bf43f /testsuite/tests/ghci | |
parent | 5ffc266e9c5ec8ed6010835165a65bd1f6b56dd4 (diff) | |
download | haskell-fc6b23be509e290f8d27775a1c637284a335ed81.tar.gz |
Fix #16525: ObjectCode freed wrongly because of lack of info header check
`checkUnload` currently doesn't check the info header of static objects.
Thus, it may free an `ObjectCode` struct wrongly even if there's still a
live static object whose info header lies in a mapped section of that
`ObjectCode`. This fixes the issue by adding an appropriate check.
Diffstat (limited to 'testsuite/tests/ghci')
-rw-r--r-- | testsuite/tests/ghci/T16525a/A.hs | 12 | ||||
-rw-r--r-- | testsuite/tests/ghci/T16525a/B.hs | 3 | ||||
-rw-r--r-- | testsuite/tests/ghci/T16525a/T16525a.script | 6 | ||||
-rw-r--r-- | testsuite/tests/ghci/T16525a/T16525a.stdout | 0 | ||||
-rw-r--r-- | testsuite/tests/ghci/T16525a/all.T | 5 |
5 files changed, 26 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/T16525a/A.hs b/testsuite/tests/ghci/T16525a/A.hs new file mode 100644 index 0000000000..dc4ced10cb --- /dev/null +++ b/testsuite/tests/ghci/T16525a/A.hs @@ -0,0 +1,12 @@ +module A where + +import B + +myIntVal :: Int +myIntVal = sum [1,2,3,4] + +value :: [Value] +value = [Value "a;lskdfa;lszkfsd;alkfjas" myIntVal] + +v1 :: Value -> String +v1 (Value a _) = a diff --git a/testsuite/tests/ghci/T16525a/B.hs b/testsuite/tests/ghci/T16525a/B.hs new file mode 100644 index 0000000000..7be77cb1b6 --- /dev/null +++ b/testsuite/tests/ghci/T16525a/B.hs @@ -0,0 +1,3 @@ +module B where + +data Value = Value String Int diff --git a/testsuite/tests/ghci/T16525a/T16525a.script b/testsuite/tests/ghci/T16525a/T16525a.script new file mode 100644 index 0000000000..d48cfd0f2d --- /dev/null +++ b/testsuite/tests/ghci/T16525a/T16525a.script @@ -0,0 +1,6 @@ +:set -fobject-code +:load A +import Control.Concurrent +_ <- forkIO $ threadDelay 1000000 >> (print (map v1 value)) +:l [] +System.Mem.performGC diff --git a/testsuite/tests/ghci/T16525a/T16525a.stdout b/testsuite/tests/ghci/T16525a/T16525a.stdout new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/testsuite/tests/ghci/T16525a/T16525a.stdout diff --git a/testsuite/tests/ghci/T16525a/all.T b/testsuite/tests/ghci/T16525a/all.T new file mode 100644 index 0000000000..6fbd3e8a4f --- /dev/null +++ b/testsuite/tests/ghci/T16525a/all.T @@ -0,0 +1,5 @@ +test('T16525a', + [extra_files(['A.hs', 'B.hs', ]), + extra_run_opts('+RTS -DS -RTS'), + when(ghc_dynamic(), skip), ], + ghci_script, ['T16525a.script']) |