Skip to content

Panic when specializing in another module

In the attached example (which requires criterion and deepseq), when compiled with ghc -O2 -funfolding-use-threshold1000 Main.hs, I get the following error on Main.hs:

ghc: panic! (the 'impossible' happened)
  (GHC version 8.0.1 for x86_64-unknown-linux):
	StgCmmEnv: variable not found
  $d(%,%)_aaTF
  local binds for:
  $trModule
  $sfool
  $trModule1
  $trModule2
  $wlvl_rgY8
  lvl_rgY9
  lvl1_rgYa
  lvl3_rgYc
  lvl4_rgYd
  lvl5_rgYe
  lvl6_rgYf
  lvl7_rgYg
  lvl8_rgYh
  lvl9_rgYi
  lvl10_rgYj
  lvl11_rgYk
  lvl12_rgYl
  lvl13_rgYm
  lvl14_rgYn
  lvl15_rgYo
  lvl16_rgYp
  lvl17_rgYq
  lvl18_rgYr
  lvl19_rgYs
  lvl20_rgYt
  lvl21_rgYu
  lvl22_rgYv
  lvl23_rgYw
  lvl24_rgYx
  lvl25_rgYy
  lvl26_rgYz
  lvl27_rgYA
  lvl28_rgYB
  lvl29_rgYC
  lvl30_rgYD
  lvl31_rgYE
  lvl32_rgYF
  lvl33_rgYG
  lvl34_rgYH
  lvl35_rgYI
  lvl36_rgYJ
  lvl37_rgYK
  lvl38_rgYL
  lvl39_rgYM
  lvl40_rgYN
  lvl41_rgYO
  lvl42_rgYP
  lvl43_rgYQ
  lvl44_rgYR
  lvl45_rgYS
  lvl46_rgYT
  lvl47_rgYU
  lvl48_rgYV
  lvl49_rgYW
  lvl50_rgYX
  lvl51_rgYY
  lvl52_rgYZ
  lvl53_rgZ0
  lvl54_rgZ1
  lvl55_rgZ2
  lvl56_rgZ3
  lvl57_rgZ4
  lvl58_rgZ5
  lvl59_rgZ6
  lvl60_rgZ7
  lvl61_rgZ8
  lvl62_rgZ9
  lvl63_rgZa
  lvl64_rgZb
  lvl65_rgZc
  lvl66_rgZd
  ww1_rgZe
  ww2_rgZf
  ww3_rgZg
  ww4_rgZh
  pinfo_rgZi
  pinfo1_rgZj
  pinfo2_rgZk
  pinfo3_rgZl
  lvl67_rgZm
  lvl68_rgZn
  lvl69_rgZo
  $wgo12_rgZp
  eta_sh1k
  wild_sh1l
  v_sh1m
  sat_sh1n

I initially found this bug when I added a SPECIALIZE pragma for fool in Main.hs. However, I need funfolding-use-threshold1000 and the constraint synonym UCRTElt in Foo.hs to trigger the bug. Every time I tried to remove criterion, the bug stopped triggering, though I seriously doubt that the bug is in criterion.

Edited by Eric Crockett
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information