diff options
author | James Clarke <jrtc27@jrtc27.com> | 2017-10-16 17:33:45 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-10-16 17:33:47 -0400 |
commit | d6c33da89b97d0d2a3b3b8f8077de8a09432d086 (patch) | |
tree | 2d5a46d3902be4326c9c1f5b6ae3da9e4eade401 | |
parent | a69fa5441c944d7f74c76bdae9f3dd198007ee42 (diff) | |
download | haskell-d6c33da89b97d0d2a3b3b8f8077de8a09432d086.tar.gz |
RtClosureInspect: Fix inspecting Char# on 64-bit big-endian
Char# is represented with a full machine word, whereas Char's Storable
instance uses an Int32, so we can't just treat it like a single-element
Char array. Instead, read it as an Int and use chr to turn it into a
Char. This fixes Trac #11262.
Reviewers: austin, hvr, bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #11262
Differential Revision: https://phabricator.haskell.org/D4089
-rw-r--r-- | compiler/ghci/RtClosureInspect.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/ghci.debugger/scripts/all.T | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/compiler/ghci/RtClosureInspect.hs b/compiler/ghci/RtClosureInspect.hs index 7c532e5755..63d1886b4d 100644 --- a/compiler/ghci/RtClosureInspect.hs +++ b/compiler/ghci/RtClosureInspect.hs @@ -57,6 +57,7 @@ import TysWiredIn import DynFlags import Outputable as Ppr import GHC.Arr ( Array(..) ) +import GHC.Char import GHC.Exts import GHC.IO ( IO(..) ) @@ -489,7 +490,9 @@ cPprTermBase y = repPrim :: TyCon -> [Word] -> SDoc repPrim t = rep where rep x - | t == charPrimTyCon = text $ show (build x :: Char) + -- Char# uses native machine words, whereas Char's Storable instance uses + -- Int32, so we have to read it as an Int. + | t == charPrimTyCon = text $ show (chr (build x :: Int)) | t == intPrimTyCon = text $ show (build x :: Int) | t == wordPrimTyCon = text $ show (build x :: Word) | t == floatPrimTyCon = text $ show (build x :: Float) diff --git a/testsuite/tests/ghci.debugger/scripts/all.T b/testsuite/tests/ghci.debugger/scripts/all.T index 9e533aa192..d62dcd97e0 100644 --- a/testsuite/tests/ghci.debugger/scripts/all.T +++ b/testsuite/tests/ghci.debugger/scripts/all.T @@ -21,8 +21,7 @@ test('print018', extra_files(['../Test.hs']), ghci_script, ['print018.script']) test('print019', extra_files(['../Test.hs']), ghci_script, ['print019.script']) test('print020', extra_files(['../HappyTest.hs']), ghci_script, ['print020.script']) test('print021', normal, ghci_script, ['print021.script']) -test('print022', when(arch('powerpc64'), expect_broken(11262)), - ghci_script, ['print022.script']) +test('print022', normal, ghci_script, ['print022.script']) test('print023', extra_files(['../Test.hs']), ghci_script, ['print023.script']) test('print024', extra_files(['../Test.hs']), ghci_script, ['print024.script']) test('print025', normal, ghci_script, ['print025.script']) |