[GHC] #16087: TH tests fail in ext-interp way when ghc-stage2 is built using LLVM

GHC ghc-devs at haskell.org
Wed Jan 30 01:09:53 UTC 2019


#16087: TH tests fail in ext-interp way when ghc-stage2 is built using LLVM
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.10.1
       Component:  Compiler (LLVM)   |              Version:  8.6.3
      Resolution:                    |             Keywords:
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 bgamari):

 I'm going to look a bit harder at `T15502`. The test is quite simple:
 {{{#!hs
 main = print ( $( lift (toInteger (maxBound :: Int) + 1) )
              , $( lift (minBound :: Int) )
              )
 }}}
 GHC falls over when evaluating the first splice. If I comment it out
 compilation finishes without crashing. Consequently, the minimal
 reproducer is:
 {{{#!hs
 {-# LANGUAGE TemplateHaskell #-}

 import Language.Haskell.TH.Syntax  (Lift(lift))

 main = print $( lift (toInteger (maxBound :: Int) + 1) )
 }}}
 compiled with `-fexternal-interpreter` by a GHC compiled with `-fllvm`.

 Indeed, this is also easily reproducible with `ghci`:
 {{{
 inplace/bin/ghc-stage2 -fexternal-interpreter --interactive
 GHCi, version 8.7.20190128: https://www.haskell.org/ghc/  :? for help
 Prelude> print $ toInteger (maxBound :: Int) + 1
 ghc-stage2: ghc-iserv terminated (-11)
 Leaving GHCi.
 }}}

 The backtrace after the crash reliably looks like:
 {{{
 >>> x/80a $rbp
 0x4200185e48:   0x8000000000000000      0x1b59860 <stg_upd_frame_info$def>
 0x4200185e58:   0x420001fad8    0x41de6980
 0x4200185e68:   0x420001fad8    0x41677621
 0x4200185e78:   0x40c63dd8      0x420001fad8
 0x4200185e88:   0x41068ca1      0x40c64290
 0x4200185e98:   0x1b59860 <stg_upd_frame_info$def>      0x4200033518
 0x4200185ea8:   0x40b5c330      0x4165e490
 0x4200185eb8:   0x4200033518    0x40b6f020
 0x4200185ec8:   0x4165e490      0x4200033518
 0x4200185ed8:   0x41068c7a      0x40a02560
 0x4200185ee8:   0x420001fa80    0x1b59040
 <stg_maskAsyncExceptionszh_ret_info$def>
 0x4200185ef8:   0x1b59490 <stg_catch_frame_info$def>    0xc
 0x4200185f08:   0x42000334aa    0x40cb3790
 0x4200185f18:   0x420002e879    0x4200032512
 0x4200185f28:   0x420002b7d0    0x420003301a
 0x4200185f38:   0x1b59490 <stg_catch_frame_info$def>    0xc
 0x4200185f48:   0x4200032002    0x40cb3790
 0x4200185f58:   0x420002e879    0x4200030082
 0x4200185f68:   0x420001fa18    0x4200031122
 0x4200185f78:   0x1b58f00 <stg_unmaskAsyncExceptionszh_ret_info$def>
 0xf38490 <cluU_info$def>
 0x4200185f88:   0x1b59490 <stg_catch_frame_info$def>    0x0
 0x4200185f98:   0x420002e7ca    0xf38570 <clv8_info$def>
 0x4200185fa8:   0x1b59490 <stg_catch_frame_info$def>    0x0
 0x4200185fb8:   0x1e02eca <rk39_closure$def+2>  0xf386c8 <clvj_info$def>
 0x4200185fc8:   0x1b59070 <stg_maskUninterruptiblezh_ret_info$def>
 0xf388d0 <clwA_info$def>
 0x4200185fd8:   0x420002e580    0x1b59490 <stg_catch_frame_info$def>
 0x4200185fe8:   0x4     0x1eaec12 <base_GHCziConcziSync_forkIO2_closure+2>
 0x4200185ff8:   0x1b5cad0 <stg_stop_thread_info$def>    0x1b56b30
 <stg_ARR_WORDS_info$def>
 0x4200186008:   0x8000  0x10000000113
 0x4200186018:   0x23000000000000        0x2000000000000000
 0x4200186028:   0x4     0x4200186158
 0x4200186038:   0x41068ca0      0x4163b8b8
 0x4200186048:   0x420002f100    0x1b13e20
 <ghczmprim_GHCziTypes_Izh_con_info$def>
 0x4200186058:   0x8000  0x1b13e70 <ghczmprim_GHCziTypes_ZC_con_info$def>
 0x4200186068:   0x4200186189    0x1fd7e11
 <ghczmprim_GHCziTypes_ZMZN_closure+1>
 0x4200186078:   0xe51ac8 <s1mVR_info$def>       0x42001861b5
 0x4200186088:   0x11953a0 <s7aK_info$def>       0x1def943
 <ghcizm8zi7_GHCiziMessage_zdfBinaryEvalStatuszu3_closure+3>
 0x4200186098:   0x1def909
 <ghcizm8zi7_GHCiziMessage_zdfBinaryEvalStatuszu6_closure+1>   0x1def8fa
 <ghcizm8zi7_GHCiziMessage_zdfBinaryEvalStatuszu7_closure+2>
 0x42001860a8:   0x119c158
 <binaryzm0zi8zi6zi0_DataziBinaryziGetziInternal_Partial_con_info$def>
 0x42001852e9
 0x42001860b8:   0x1195080 <s7aS_info$def>       0x1b13e70
 <ghczmprim_GHCziTypes_ZC_con_info$def>
 }}}

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


More information about the ghc-tickets mailing list