[GHC] #12614: Integer division can overwrite other arguments to foreign call

GHC ghc-devs at haskell.org
Sat Oct 1 21:50:31 UTC 2016


#12614: Integer division can overwrite other arguments to foreign call
-------------------------------------+-------------------------------------
        Reporter:  jscholl           |                Owner:
            Type:  bug               |               Status:  patch
        Priority:  high              |            Milestone:  8.0.2
       Component:  Compiler (NCG)    |              Version:  8.0.1
      Resolution:                    |             Keywords:  integer
                                     |  division
Operating System:  Unknown/Multiple  |         Architecture:  x86_64
 Type of failure:  Incorrect result  |  (amd64)
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #11792            |  Differential Rev(s):  Phab:D2263
       Wiki Page:                    |
-------------------------------------+-------------------------------------

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

 In [changeset:"b61b7c2462b919de7eb4c373e2e2145c6d78d04c/ghc"
 b61b7c24/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="b61b7c2462b919de7eb4c373e2e2145c6d78d04c"
 CodeGen X86: fix unsafe foreign calls wrt inlining

 Foreign calls (unsafe and safe) interact badly with inlining and
 register passing ABIs (see #11792 and #12614):
 the inlined code to compute a parameter of the call may overwrite a
 register already set to pass a preceding parameter.

 With this patch, we compute all parameters which are not simple
 expressions before assigning them to fixed registers required by the
 ABI.

 Test Plan:
    - Add test (test both reg and stack parameters)
    - Validate

 Reviewers: osa1, bgamari, austin, simonmar

 Reviewed By: simonmar

 Subscribers: thomie

 Differential Revision: https://phabricator.haskell.org/D2263

 GHC Trac Issues: #11792, #12614
 }}}

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


More information about the ghc-tickets mailing list