[GHC] #12585: GHC duplicates string literals in rodata section and breaks 'Ptr Addr#' equality

GHC ghc-devs at haskell.org
Mon Sep 12 08:01:37 UTC 2016


#12585: GHC duplicates string literals in rodata section and breaks 'Ptr Addr#'
equality
-------------------------------------+-------------------------------------
        Reporter:  slyfox            |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.1
      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 simonpj):

 What about `Ptr "foo"# == Ptr "foo"#`?  That is, two textually-distinct
 string literals.  Are they distinct or the same?

 It is probably a mistake for string literals to have type `Addr#`.
  * Addresses of type `Addr#` certainly should be compared simply by
 comparing their values
  * But string should not be compared by comparing their addresses.

 Still, I suppose that if every string literal in the program gave rise to
 a single top-level defintion in the program, that might help.  See #8472

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


More information about the ghc-tickets mailing list