[GHC] #11312: GHC inlining primitive string literals can affect program output

GHC ghc-devs at haskell.org
Tue Oct 25 23:58:57 UTC 2016


#11312: GHC inlining primitive string literals can affect program output
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #11292            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by duncan):

 From the point of view of the bytestring package, what we would like is an
 O(1) way to convert from a constant/literal string to a pinned
 `ByteArray#` since we can build a `ByteString` from one of those.

 You may say why not just convert to a raw `Addr#` given that `ByteString`
 uses `ForeignPtr` which can use pointers. Well, long term we'd like to
 eliminate the use of `ForeignPtr` and use only pinned or unpinned
 `ByteArray#`s, and similarly in the long term `Text` will switch to UTF8
 and it already uses `ByteArray` not `ForeignPtr`. So long term, to have
 O(1) `Text` or `ByteString` literals we'd need to be able to convert to
 `ByteArray#`.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11312#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list