[GHC] #14090: Static pointers are not being registered under certain conditions

GHC ghc-devs at haskell.org
Fri Aug 4 20:20:47 UTC 2017


#14090: Static pointers are not being registered under certain conditions
-------------------------------------+-------------------------------------
        Reporter:  mnislaih          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.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):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by mnislaih:

Old description:

> It seems that if the module is compiled with -O2 only the static pointers
> in the module export list survive the Simplifier. This is a regression.
>
> {{{
> {-# LANGUAGE StaticPointers #-}
>
> import GHC.StaticPtr
>
> staticHello :: StaticPtr String
> staticHello = static "hello"
>
> main = do
>   keys <- staticPtrKeys
>   if null keys
>     then error "static ptrs are not being registered"
>     else putStrLn "Everything is fine"
> }}}
> {{{
> pepe:~/scratch$ stack --resolver ghc-8.2.1 script --optimize bug-spt.hs
> Using resolver: ghc-8.2.1 specified on command line
> bug-spt: static ptrs are not being registered
> CallStack (from HasCallStack):
>   error, called at bug-spt.hs:11:10 in main:Main
> pepe:~/scratch$ stack --resolver ghc-8.0.2 script --optimize bug-spt.hs
> Using resolver: ghc-8.0.2 specified on command line
> Everything is fine
> }}}

New description:

 It seems that only the static pointers in the module export list survive
 the Simplifier. This is a regression which doesn't seem to affect
 ghci/runghc only compiled code.

 {{{
 {-# LANGUAGE StaticPointers #-}

 import GHC.StaticPtr

 staticHello :: StaticPtr String
 staticHello = static "hello"

 main = do
   keys <- staticPtrKeys
   if null keys
     then error "static ptrs are not being registered"
     else putStrLn "Everything is fine"
 }}}
 {{{
 pepe:~/scratch$ stack --resolver ghc-8.2.1 script --optimize bug-spt.hs
 Using resolver: ghc-8.2.1 specified on command line
 bug-spt: static ptrs are not being registered
 CallStack (from HasCallStack):
   error, called at bug-spt.hs:11:10 in main:Main
 pepe:~/scratch$ stack --resolver ghc-8.0.2 script --optimize bug-spt.hs
 Using resolver: ghc-8.0.2 specified on command line
 Everything is fine
 }}}

--

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


More information about the ghc-tickets mailing list