Skip to content

Tests tend to fail in the ext-interp way when split sections is enabled

One issue I've noticed while working on #13716 (closed) is that most (if not all) of the tests runs in the ext-interp way fail when run with a compiler built with SplitSections=YES.

$ git clone git://git.haskell.org/ghc
$ cd ghc
$ git submodule update --init
$ mk/get-win32-tarballs.sh download all
$ ./boot
$ ./configure
$ make sdist
$ mkdir tmp; cd tmp
$ ls ../sdistprep/ghc-*-src.tar.xz | xargs -n1 tar -xf
$ cd ghc-*
$ ./boot
$ ./configure
$ make -j9
$ make test TEST=T10638
...
=====> T10638(normal) 1 of 1 [0, 0, 0]
cd "./th/T10638.run" &&  "/mnt/work/ghc/ghc-testing/temp/ghc-8.3.20170927/inplace/bin/ghc-stage2" -c T10638.hs -dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -dno-debug-output -XTemplateHaskell -package template-haskell -v0
=====> T10638(ext-interp) 1 of 1 [0, 0, 0]
cd "./th/T10638.run" &&  "/mnt/work/ghc/ghc-testing/temp/ghc-8.3.20170927/inplace/bin/ghc-stage2" -c T10638.hs -dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -dno-debug-output -XTemplateHaskell -package template-haskell -fexternal-interpreter -v0
Actual stderr output differs from expected:
diff -uw "./th/T10638.run/T10638.stderr.normalised" "./th/T10638.run/T10638.comp.stderr.normalised"
--- ./th/T10638.run/T10638.stderr.normalised	2017-09-27 12:18:45.737974039 -0400
+++ ./th/T10638.run/T10638.comp.stderr.normalised	2017-09-27 12:18:45.737974039 -0400
@@ -1,5 +1,18 @@
+ghc-iserv.bin: internal evacuate(static): strange closure type 16476
+    (GHC version 8.3.20170927 for x86_64_unknown_linux)
+    Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
 
-T10638.hs:26:11:
-    ‘static test2’ is not a valid C identifier
-    When checking declaration:
-      foreign import prim safe "static test2" cmm_test2 :: Int# -> Int#
+T10638.hs:26:9:
+     Exception when trying to run compile-time code:
+        {handle: <file descriptor: 11>}: GHCi.Message.remoteCall: end of file
+      Code: do t <- [t| Int# -> Int# |]
+               cmm_test2 <- newName "cmm_test2"
+               addTopDecls
+                 [ForeignD (ImportF Prim Safe "static test2" cmm_test2 t)]
+               ....
+     In the untyped splice:
+        $(do t <- [t| Int# -> Int# |]
+             cmm_test2 <- newName "cmm_test2"
+             addTopDecls
+               [ForeignD (ImportF Prim Safe "static test2" cmm_test2 t)]
+             [| test1 |])
*** unexpected failure for T10638(ext-interp)

Unexpected results from:
TEST="T10638"
...

The crashes are generally RTS panics or segmentation faults.

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