[GHC] #9413: Outputable instance for Unique sometimes generates null bytes
#9413: Outputable instance for Unique sometimes generates null bytes -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 Keywords: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Unknown | Type of failure: Other Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Steps to reproduce: {{{ [ezyang@hs01 ghc-validate]$ inplace/bin/ghc-stage2 --interactive -package ghc GHCi, version 7.9.20140805: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package array-0.5.0.0 ... linking ... done. Loading package deepseq-1.3.0.2 ... linking ... done. Loading package bytestring-0.10.4.0 ... linking ... done. Loading package containers-0.5.5.1 ... linking ... done. Loading package filepath-1.3.0.2 ... linking ... done. Loading package old-locale-1.0.0.6 ... linking ... done. Loading package time-1.4.2 ... linking ... done. Loading package unix-2.7.0.2 ... linking ... done. Loading package directory-1.2.1.0 ... linking ... done. Loading package pretty-1.1.1.1 ... linking ... done. Loading package process-1.2.0.0 ... linking ... done. Loading package Cabal-1.21.0.0 ... linking ... done. Loading package binary-0.7.1.0 ... linking ... done. Loading package bin-package-db-0.0.0.0 ... linking ... done. Loading package hoopl-3.10.0.1 ... linking ... done. Loading package hpc-0.6.0.1 ... linking ... done. Loading package template-haskell ... linking ... done. Loading package transformers-0.4.1.0 ... linking ... done. Loading package ghc ... linking ... done. Prelude> :m +Unique Prelude Unique> :m +Outputable Prelude Unique Outputable> :m +FastString Prelude Unique Outputable FastString> :m +DynFlags Prelude Unique Outputable FastString DynFlags> showSDoc (defaultDynFlags undefined) $ ppr (getUnique (mkFastString "foo")) "\NUL3bS" }}} We should do something so this doesn't happen. Caused grief due to #9395 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9413> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9413: Outputable instance for Unique sometimes generates null bytes -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: Other | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by Edward Z. Yang <ezyang@…>): In [changeset:"4855be0d0d1ac90f836a6fb54f4034f478e38fd8/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="4855be0d0d1ac90f836a6fb54f4034f478e38fd8" Give the Unique generated by strings a tag '$', fixes #9413. Summary: Previously, we allocated uniques for strings starting at zero, which means the tag bits in the unique are zero, which means that printing a Unique for a string will start with a null byte. This is bad. So instead, start our numbering with the tag byte as '$' (as in $tring). This is hard coded so we don't have to worry about the optimizer reducing the expression. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: hvr, simonmar, austin Subscribers: simonmar, relrod, ezyang, carter Differential Revision: https://phabricator.haskell.org/D123 GHC Trac Issues: #9413 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9413#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9413: Outputable instance for Unique sometimes generates null bytes -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.9 Resolution: fixed | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: Other | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by ezyang): * status: new => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9413#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC