[GHC] #15300: Unboxed Sums Crash

GHC ghc-devs at haskell.org
Thu Jul 12 10:46:01 UTC 2018


#15300: Unboxed Sums Crash
-------------------------------------+-------------------------------------
        Reporter:  andrewthad        |                Owner:  osa1
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.5
      Resolution:                    |             Keywords:  UnboxedSums
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by osa1):

 Aha! The problem is StgCse's term equality check does not work on unboxed
 sums. Are these two equal? (and a binder to one could be substituted for
 the other?)

 - `(# 1# | #) :: (# Int# | Bool #)`
 - `(# 1# | #) :: (# Int# | Int# #)`

 Of course not, becuse first one unarises to `(# 1#, 1#, absentSumField #)`
 while the second one unarises to `(# 1#, 1# #)`.

 Not sure how to compare unboxed sums for equality in StgCse as we don't
 have enough type information at that point. However, it seems to me that
 CSE on unboxed sums is useless as unboxed sums are not allocated (so CSE
 doesn't buy us anything). Maybe we should just not do CSE on unboxed sum
 (and maybe even tuple) terms.

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


More information about the ghc-tickets mailing list