[GHC] #13695: Highly nested UNPACKed data causes panic

#13695: Highly nested UNPACKed data causes panic ----------------------------------------+--------------------------------- Reporter: ryanreich | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Keywords: | Operating System: Linux Architecture: Unknown/Multiple | Type of failure: None/Unknown Test Case: | Blocked By: Blocking: | Related Tickets: 3990 Differential Rev(s): | Wiki Page: ----------------------------------------+--------------------------------- See attached source files. I get the following error: {{{ [3 of 3] Compiling Data.BigWord ( src/Data/BigWord.hs, .stack- work/dist/x86_64-linux/Cabal-2.0.0.0/build/Data/BigWord.o ) ghc: panic! (the 'impossible' happened) (GHC version 8.2.0.20170505 for x86_64-unknown-linux): urk! lookup local fingerprint D:R:DoubleWordDoubleWord2 [cESifd :-> (BigWord2, acd0b93ce6ccc191df910f3c0527af52), cESife :-> (BigWord3, c2394bb5a6246cea8260b764c4645609), cESiqK :-> (BigWord4, dfeb99d5c409e91fe7084935101bb1a8), cESiqT :-> (R:DoubleWordDoubleWord3, 00000000000000000000000000000000), cESiqV :-> (D:R:DoubleWordDoubleWord4, 00000000000000000000000000000000), cESir1 :-> (D:R:BigWord4, 7d2736129b3a85c7e71bc1954bb41ec0), dESiqK :-> (BigWord4, d51a0117843c625086a534a6e4b47d85), iESiqK :-> (BigWord4, 139d5d98471af07fbafb30541b5ec225), iESiqX :-> ($WBigWord4, df51c2cc8c85fdd30898a16f2568c91a)] Call stack: CallStack (from HasCallStack): prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1134:58 in ghc:Outputable callStackDoc, called at compiler/utils/Outputable.hs:1138:37 in ghc:Outputable pprPanic, called at compiler/iface/MkIface.hs:508:37 in ghc:MkIface }}} I need to use ghc-8.2.1 because it seems to be the earliest version that contains the fixes in [https://ghc.haskell.org/trac/ghc/ticket/3990], without which the UNPACKs will be ignored. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13695 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13695: Highly nested UNPACKed data causes panic ---------------------------------+---------------------------------------- Reporter: ryanreich | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: 3990 | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by ryanreich): * Attachment "BigWord.hs" added. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13695 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13695: Highly nested UNPACKed data causes panic ---------------------------------+---------------------------------------- Reporter: ryanreich | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: 3990 | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by ryanreich): * Attachment "BigWordUnpack.hs" added. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13695 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13695: Highly nested UNPACKed data causes panic ---------------------------------+---------------------------------------- Reporter: ryanreich | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: 3990 | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by ryanreich): * Attachment "BigWordClass.hs" added. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13695 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13695: Highly nested UNPACKed data causes panic ---------------------------------+---------------------------------------- Reporter: ryanreich | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3990 | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by bgamari): * priority: normal => high * related: 3990 => #3990 * milestone: => 8.2.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13695#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13695: Highly nested UNPACKed data causes panic ---------------------------------+---------------------------------------- Reporter: ryanreich | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3990 | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Comment (by RyanGlScott): I can't reproduce this error with GHC 8.2.1 or HEAD: {{{ $ /opt/ghc/8.2.1/bin/ghc -fforce-recomp -O2 BigWord.hs [1 of 3] Compiling BigWordClass ( BigWordClass.hs, BigWordClass.o ) [2 of 3] Compiling BigWordUnpack ( BigWordUnpack.hs, BigWordUnpack.o ) [3 of 3] Compiling BigWord ( BigWord.hs, BigWord.o ) }}} Is there something in particular I need to do to trigger this panic? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13695#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13695: Highly nested UNPACKed data causes panic ---------------------------------+---------------------------------------- Reporter: ryanreich | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3990 | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Comment (by ryanreich): That's odd; it should "work" as-is. I wonder if I got the ghc version wrong? It's shown in the panic message, though: 8.2.0.20170505. Just in case this is an issue of some more obscure environment, let me post my stack.yaml and bigint.cabal as well. Also, here's my system info: {{{ ryan@thermophile $ uname -a Linux thermophile 4.8.0-49-generic #52-Ubuntu SMP Thu Apr 20 09:38:39 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux ryan@thermophile $ free -h total used free shared buff/cache available Mem: 7.7G 2.3G 1.9G 321M 3.5G 4.7G Swap: 3.7G 0B 3.7G ryan@thermophile $ cat /proc/cpuinfo processor : 3 (and 0, 1, 2) vendor_id : GenuineIntel cpu family : 6 model : 142 model name : Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz stepping : 9 microcode : 0x3c cpu MHz : 799.871 cache size : 4096 KB physical id : 0 siblings : 4 core id : 1 cpu cores : 2 apicid : 3 initial apicid : 3 fpu : yes fpu_exception : yes cpuid level : 22 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp bugs : bogomips : 5800.00 clflush size : 64 cache_alignment : 64 address sizes : 39 bits physical, 48 bits virtual power management: }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13695#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13695: Highly nested UNPACKed data causes panic ---------------------------------+---------------------------------------- Reporter: ryanreich | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3990 | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by ryanreich): * Attachment "stack.yaml" added. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13695 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13695: Highly nested UNPACKed data causes panic ---------------------------------+---------------------------------------- Reporter: ryanreich | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3990 | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by ryanreich): * Attachment "bigint.cabal" added. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13695 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13695: Highly nested UNPACKed data causes panic ---------------------------------+---------------------------------------- Reporter: ryanreich | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3990 | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Comment (by RyanGlScott): I wasn't able to reproduce this using `cabal build` or `stack build` either. Note that I obtained GHC 8.2.1: {{{ $ /opt/ghc/8.2.1/bin/ghc --version The Glorious Glasgow Haskell Compilation System, version 8.2.0.20170505 }}} and GHC HEAD: {{{ $ /opt/ghc/head/bin/ghc --version The Glorious Glasgow Haskell Compilation System, version 8.3.20170509 }}} from https://launchpad.net/~hvr/+archive/ubuntu/ghc -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13695#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13695: Highly nested UNPACKed data causes panic ---------------------------------+---------------------------------------- Reporter: ryanreich | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3990 | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Comment (by ryanreich): I'm using exactly the same builds myself. I went and tried it with HEAD and it seemed to have the same failure, but after switching the version back and forth a few times it started actually working (!). I was doing `stack clean` in between, so the runs should have been independent. I can't make it happen at all anymore, so I wonder if it was an issue of the dynamic libraries with the same version having been mapped into memory, and now replaced with the correct one? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13695#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13695: Highly nested UNPACKed data causes panic ---------------------------------+---------------------------------------- Reporter: ryanreich | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3990 | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Comment (by ryanreich): Okay, I did another test and found that changing the 4 to a 5 in BigWord.hs causes the panic again. I don't know what number will "work" for you, but try increasing it until it does panic. Weirdly, switching between 8.2.1 and HEAD causes that to work, but changing it to 6 breaks it again. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13695#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13695: Highly nested UNPACKed data causes panic ---------------------------------+---------------------------------------- Reporter: ryanreich | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3990 | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by RyanGlScott): * Attachment "BigWordClass2.hs" added. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13695 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13695: Highly nested UNPACKed data causes panic ---------------------------------+---------------------------------------- Reporter: ryanreich | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3990 | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by RyanGlScott): * Attachment "BigWordUnpack2.hs" added. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13695 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13695: Highly nested UNPACKed data causes panic ---------------------------------+---------------------------------------- Reporter: ryanreich | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3990 | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by RyanGlScott): * Attachment "BigWord2.hs" added. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13695 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13695: Highly nested UNPACKed data causes panic ---------------------------------+---------------------------------------- Reporter: ryanreich | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3990 | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Comment (by RyanGlScott): Ah, it seems that rebuilding with slight changes is crucial to triggering this bug. I've attached simplified versions of your original programs that remove the Template Haskell stuff and make clear what specific change is needed to make GHC panic. In particular, to reproduce this bug, do the following with either GHC 8.2.1 or HEAD: 1. Run `/opt/ghc/8.2.1/bin/ghc BigWord2.hs -O2` 2. Edit `BigWord2.hs`, and uncomment the block of code at the bottom (the one that starts with `type instance BigWord 5 = BigWord5` and ends with `instance LowHigh BigWord4 where ...`) 3. Run `/opt/ghc/8.2.1/bin/ghc BigWord2.hs -O2` again: {{{ $ /opt/ghc/8.2.1/bin/ghc BigWord2.hs -O2 [3 of 3] Compiling BigWord2 ( BigWord2.hs, BigWord2.o ) ghc: panic! (the 'impossible' happened) (GHC version 8.2.0.20170505 for x86_64-unknown-linux): urk! lookup local fingerprint D:R:DoubleWordDoubleWord4 [cESeWE :-> (BigWord2, 34dc4d50eaf3c3f1fec88a99dae21850), cESfxE :-> (BigWord3, 2b1c1772a861f399344dc06c29e7e7c0), cESfxF :-> (BigWord4, df345db7e7bc5c1dd0c73d6b038bc339), cESfxY :-> (BigWord5, 2b3cbb09e91bec36a2a2c359191139d2), cESg1l :-> (R:DoubleWordDoubleWord5, 00000000000000000000000000000000), cESg1n :-> (D:R:DoubleWordDoubleWord6, 00000000000000000000000000000000), cESg1v :-> (D:R:BigWord5, 560a80c635c7dd211457b5d4dab86d51), dESfxY :-> (BigWord5, 775d4a6ae2e1194445cb6e4252de8b91), iESfxY :-> (BigWord5, fc430fea13ebb9a94e051713cccf16ee), iESg1p :-> ($WBigWord5, c95ed7d25584a6ae4abaf9ae169cd259)] Call stack: CallStack (from HasCallStack): prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1134:58 in ghc:Outputable callStackDoc, called at compiler/utils/Outputable.hs:1138:37 in ghc:Outputable pprPanic, called at compiler/iface/MkIface.hs:508:37 in ghc:MkIface Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13695#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13695: Highly nested UNPACKed data causes panic ---------------------------------+---------------------------------------- Reporter: ryanreich | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3990 | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by dfeuer): * cc: ezyang (added) Comment: It looks like ezyang was the last one to work in this general area; he may not be responsible, but it seems somewhat likely that he may still remember something about how this code works. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13695#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13695: Highly nested UNPACKed data causes panic ---------------------------------+---------------------------------------- Reporter: ryanreich | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3990 | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Comment (by simonpj): I'm on this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13695#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13695: Highly nested UNPACKed data causes panic
---------------------------------+----------------------------------------
Reporter: ryanreich | Owner: (none)
Type: bug | Status: new
Priority: high | Milestone: 8.2.1
Component: Compiler | Version: 8.2.1-rc2
Resolution: | Keywords:
Operating System: Linux | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #3990 | Differential Rev(s):
Wiki Page: |
---------------------------------+----------------------------------------
Comment (by Simon Peyton Jones

#13695: Highly nested UNPACKed data causes panic ---------------------------------+---------------------------------------- Reporter: ryanreich | Owner: (none) Type: bug | Status: merge Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3990 | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by simonpj): * status: new => merge Comment: Thanks for the test case. It was a simple, outright bug. Worth merging. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13695#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13695: Highly nested UNPACKed data causes panic ---------------------------------+---------------------------------------- Reporter: ryanreich | Owner: (none) Type: bug | Status: closed Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: fixed | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #3990 | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged in 1e93425ee78481f10f79cb1d39b6cd4f11f38e5d. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13695#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC