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

GHC ghc-devs at haskell.org
Wed Jan 6 19:22:04 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 RyanGlScott):

 To collect some of the comments you've made in #8472 and #11292, is this
 what you want to be done?

 1. Introduce a new `String#` type, and make primitive string literals
 their values, e.g., `"foo"# :: String#`.
 2. Allow top-level `String#`s, e.g.,

 {{{#!hs
 a::Addr# = "foo"#
 }}}

    but not top-level `String#` computations, which would entail:
       * Modify the test `isUnLiftedType ty` in `SetLevels.lvlMFE`, which
 stops unlifted things getting floated to top level.
       * Similarly `Simplify.bindingOk`.
       * Make `CmmLint` check the new invariant.
       * The STG->Cmm code generator would need to generate some suitable
 `CmmData` stuff.
 3. Introduce primitive operations that manipulate `String#`s (e.g., a
 Haskell equivalent of `strcmp`)

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


More information about the ghc-tickets mailing list