summaryrefslogtreecommitdiff
path: root/compiler/utils/FastString.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/utils/FastString.hs')
-rw-r--r--compiler/utils/FastString.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/utils/FastString.hs b/compiler/utils/FastString.hs
index c53eff1dd1..f9fbeb0e6e 100644
--- a/compiler/utils/FastString.hs
+++ b/compiler/utils/FastString.hs
@@ -114,14 +114,13 @@ import qualified Data.ByteString.Unsafe as BS
import Foreign.C
import GHC.Exts
import System.IO
-import System.IO.Unsafe ( unsafePerformIO )
import Data.Data
import Data.IORef
import Data.Maybe ( isJust )
import Data.Char
import Data.Semigroup as Semi
-import GHC.IO ( IO(..), unIO, unsafeDupablePerformIO )
+import GHC.IO
import Foreign
@@ -400,6 +399,9 @@ mkFastStringWith mk_fs !ptr !len = do
case res of
Just found -> return found
Nothing -> do
+ -- The withMVar below is not dupable. It can lead to deadlock if it is
+ -- only run partially and putMVar is not called after takeMVar.
+ noDuplicate
n <- get_uid
new_fs <- mk_fs n
withMVar lock $ \_ -> insert new_fs