[GHC] #14868: -O -g breaks string literals

GHC ghc-devs at haskell.org
Wed Feb 28 11:18:30 UTC 2018


#14868: -O -g breaks string literals
-------------------------------------+-------------------------------------
           Reporter:  akio           |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.5
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Incorrect result
  Unknown/Multiple                   |  at runtime
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 With `foo.hs`:

 {{{#!hs
 main = print (4, "foo")
 }}}

 Compile it and run it like:

 {{{
 % ghc-stage2 -O -g foo.hs
 % ./foo
 (4,"\CANq@")
 }}}

 Note that the content of the string literal is broken, although the length
 is preserved.

 With `-dcore-lint`, the following error is produced:

 {{{
 *** Core Lint errors : in result of Simplifier ***
 <no location info>: warning:
     [RHS of ww2_s3hG :: Addr#]
     Recursive or top-level binder has strict demand info: ww2_s3hG
     Binder's demand info: <L,U>
 }}}

 The offending binding is:

 {{{#!hs
 ww2_s3hG :: Addr#
 [LclId,
  Unf=Unf{Src=<vanilla>, TopLvl=False, Value=True, ConLike=True,
          WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
 ww2_s3hG = src<foo.hs:1:18-22> "foo"#
 }}}

 Happens with ghc 8.4.1-rc1 and with HEAD (df2c3b33648).

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


More information about the ghc-tickets mailing list