[GHC] #12622: Unboxed static pointers lead to missing SPT entries

GHC ghc-devs at haskell.org
Tue Nov 15 18:55:08 UTC 2016


#12622: Unboxed static pointers lead to missing SPT entries
-------------------------------------+-------------------------------------
        Reporter:  mboes             |                Owner:
                                     |  facundo.dominguez
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D2709
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by facundo.dominguez):

 Preventing StaticPtrs from being unpacked is not necessary.

 Turns out that there is a bug in the code that floats out static pointers.
 The identifier of the following binding is not exported and it should.
 {{{
 lvl_sG5 :: forall a_aEy. StaticPtr (a_aEy -> Bool)
 lvl_sG5 =
   \ (@ a_aEy) ->
     GHC.StaticPtr.StaticPtr
       @ (a_aEy -> Bool)
       13520098690657238824##
       6110703080284699228##
       lvl_sG4
       (g @ a_aEy)
 }}}
 Having the id as exported, prevents the simplifier from removing it, which
 is what we want. However, our minimal example still fails linting.

 The problem is this line in `Main.hs`:
 {{{
 let T s = sg :: T (Bool -> Bool)
 }}}
 Which gets translated to
 {{{
 s :: StaticPtr (Bool -> Bool)
 s = case sg of
     T dt_d2bM dt_d2bN dt_d2bO dt_d2bP ->
       GHC.StaticPtr.StaticPtr dt_d2bM dt_d2bN dt_d2bO dt_d2bP
 }}}
 which the linter rejects because it contains an occurrence of the
 StaticPtr data constructor which cannot be floated.

 Note that this occurrence is harmless, since it is not created by a
 `static` form and does not correspond to an entry in the Static Pointer
 Table. Nonetheless, the linter is confused, and I don't know yet how to
 help it.

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


More information about the ghc-tickets mailing list