[GHC] #14361: GHC HEAD miscompiles `text-containers`

GHC ghc-devs at haskell.org
Mon Nov 6 21:39:33 UTC 2017


#14361: GHC HEAD miscompiles `text-containers`
-------------------------------------+-------------------------------------
        Reporter:  hvr               |                Owner:  (none)
            Type:  bug               |               Status:  patch
        Priority:  high              |            Milestone:  8.4.1
       Component:  Compiler          |              Version:  8.3
      Resolution:                    |             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:                    |
-------------------------------------+-------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"6f990c54f922beae80362fe62426beededc21290/ghc"
 6f990c54/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="6f990c54f922beae80362fe62426beededc21290"
 cmm/CBE: Fix comparison between blocks of different lengths

 Previously CBE computed equality by taking the lists of middle nodes of
 the blocks being compared and zipping them together. It would then map
 over this list with the equality relation, and accumulate the result.

 However, this is completely wrong: Consider what will happen when we
 compare a block with no middle nodes with one with one or more. The
 result of `zip` will be empty and consequently the pass may conclude
 that the two are indeed equivalent (if their last nodes also match).
 This is very bad and the cause of #14361.

 The solution I chose was just to write out an explicit recursion, like I
 distinctly recall considering doing when I first wrote this code.
 Unfortunately I was feeling clever at the time.

 Unfortunately this case was just rare enough not to be triggered by the
 testsuite. I still need to find a testcase that doesn't have external
 dependencies.

 Test Plan: Need to find a more minimal testcase

 Reviewers: austin, simonmar, michalt

 Reviewed By: michalt

 Subscribers: michalt, rwbarton, thomie, hvr

 GHC Trac Issues: #14361

 Differential Revision: https://phabricator.haskell.org/D4152
 }}}

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


More information about the ghc-tickets mailing list