[GHC] #13027: Core lint errors compiling containers HEAD with GHC HEAD

GHC ghc-devs at haskell.org
Thu Dec 22 04:40:31 UTC 2016


#13027: Core lint errors compiling containers HEAD with GHC HEAD
-------------------------------------+-------------------------------------
        Reporter:  erikd             |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  8.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Building GHC      |  Unknown/Multiple
  failed                             |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 It also gives a core lint error as early as 7.10.1.

 I found that early on the simplifier produces
 {{{
     case x_a3Iw of x_X3IE { __DEFAULT ->
     ...
             case GHC.Prim.tagToEnum#
                    @ Bool (reallyUnsafePtrEquality# @ a x_X3IE y_a3IA)
             of {
             ...
             }
     }
 }}}
 This is apparently okay: the application of `tagToEnum#` to the
 `reallyUnsafePtrEquality#` call is okay because `reallyUnsafePtrEquality#`
 is safe for speculation and the arguments `x_X3IE` and `y_a3IA` are known
 to be evaluated (`x_X3IE` came from evaluating the scrutinee of a case and
 `y_a3IA` came from the strict field of `Bin`).

 However the FloatOut pass does a "binder swap"
 (https://github.com/ghc/ghc/blob/master/compiler/simplCore/SetLevels.hs#L37)
 where it turns the reference to `x_X3IE` into a reference to `x_a3Iw`. Now
 `x_a3Iw` is not known to be evaluated so `reallyUnsafePtrEquality#` is no
 longer considered to be safe for speculation. (Even though
 `reallyUnsafePtrEquality#` doesn't actually evaluate its arguments.)

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


More information about the ghc-tickets mailing list