`inline-c-cpp` test suite segfaults on `ghc-9.4` branch on Windows
Using this head.hackage
patch, the test suite for the inline-c-cpp-0.5.0.0
Hackage library segfaults on Windows when compiled with the ghc-9.4
branch (commit 805a4b1f):
$ ../../../../Software/cabal.exe test inline-c-cpp
Warning: Unknown/unsupported 'ghc' version detected (Cabal 3.7.0.0 supports
'ghc' version < 9.4):
C:\Users\winferno\Software\ghc-9.4.0.20220715\bin\ghc.exe is version
9.4.0.20220715
Resolving dependencies...
Build profile: -w ghc-9.4.0.20220715 -O1
In order, the following will be built (use -v for more details):
- inline-c-cpp-0.5.0.0 (lib) (first run)
- inline-c-cpp-0.5.0.0 (test:tests) (first run)
Configuring library for inline-c-cpp-0.5.0.0..
Preprocessing library for inline-c-cpp-0.5.0.0..
Building library for inline-c-cpp-0.5.0.0..
[1 of 3] Compiling Language.C.Inline.Cpp ( src\Language\C\Inline\Cpp.hs, C:\\Users\winferno\Documents\Hacking\Haskell\staging\dist-newstyle\build\x86_64-windows\ghc-9.4.0.20220715\inline-c-cpp-0.5.0.0\build\Language\C\Inline\Cpp.o )
src\Language\C\Inline\Cpp.hs:16:1: warning: [-Wunused-imports]
The import of ‘Data.Monoid’ is redundant
except perhaps to import instances from ‘Data.Monoid’
To import instances alone, use: import Data.Monoid()
|
16 | import Data.Monoid ((<>), mempty)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2 of 3] Compiling Language.C.Inline.Cpp.Exception ( src\Language\C\Inline\Cpp\Exception.hs, C:\\Users\winferno\Documents\Hacking\Haskell\staging\dist-newstyle\build\x86_64-windows\ghc-9.4.0.20220715\inline-c-cpp-0.5.0.0\build\Language\C\Inline\Cpp\Exception.o )
clang++: warning: argument unused during compilation: '--unwindlib=libunwind' [-Wunused-command-line-argument]
[3 of 3] Compiling Language.C.Inline.Cpp.Exceptions ( src\Language\C\Inline\Cpp\Exceptions.hs, C:\\Users\winferno\Documents\Hacking\Haskell\staging\dist-newstyle\build\x86_64-windows\ghc-9.4.0.20220715\inline-c-cpp-0.5.0.0\build\Language\C\Inline\Cpp\Exceptions.o )
clang++: warning: argument unused during compilation: '--unwindlib=libunwind' [-Wunused-command-line-argument]
clang++: warning: argument unused during compilation: '--unwindlib=libunwind' [-Wunused-command-line-argument]
Configuring test suite 'tests' for inline-c-cpp-0.5.0.0..
Preprocessing test suite 'tests' for inline-c-cpp-0.5.0.0..
Building test suite 'tests' for inline-c-cpp-0.5.0.0..
[1 of 4] Compiling StdVector ( test\StdVector.hs, C:\\Users\winferno\Documents\Hacking\Haskell\staging\dist-newstyle\build\x86_64-windows\ghc-9.4.0.20220715\inline-c-cpp-0.5.0.0\t\tests\build\tests\tests-tmp\StdVector.o )
[2 of 4] Compiling Main ( test\tests.hs, C:\\Users\winferno\Documents\Hacking\Haskell\staging\dist-newstyle\build\x86_64-windows\ghc-9.4.0.20220715\inline-c-cpp-0.5.0.0\t\tests\build\tests\tests-tmp\Main.o )
clang++: warning: argument unused during compilation: '--unwindlib=libunwind' [-Wunused-command-line-argument]
[3 of 4] Compiling TemplateSpec ( test\TemplateSpec.hs, C:\\Users\winferno\Documents\Hacking\Haskell\staging\dist-newstyle\build\x86_64-windows\ghc-9.4.0.20220715\inline-c-cpp-0.5.0.0\t\tests\build\tests\tests-tmp\TemplateSpec.o )
clang++: warning: argument unused during compilation: '--unwindlib=libunwind' [-Wunused-command-line-argument]
[4 of 4] Linking C:\\Users\\winferno\\Documents\\Hacking\\Haskell\\staging\\dist-newstyle\\build\\x86_64-windows\\ghc-9.4.0.20220715\\inline-c-cpp-0.5.0.0\\t\\tests\\build\\tests\\tests.exe
ld.lld: warning: libHSinline-c-cpp-0.5.0.0-inplace.a(HaskellException.o): locally defined symbol imported: __cxa_current_exception_type (defined in libc++.a(cxa_exception.cpp.obj)) [LNK4217]
ld.lld: warning: libHSinline-c-cpp-0.5.0.0-inplace.a(HaskellException.o): locally defined symbol imported: __cxa_demangle (defined in libc++.a(cxa_demangle.cpp.obj)) [LNK4217]
Running 1 test suites...
Test suite tests: RUNNING...
Basic C++
Hello, world!3
Hello World [✔]
C++ Types
3
Hello Namespace [✔]
100
Hello Template [✔]
Template + Namespace [✔]
1
Template with 2 arguments [✔]
Exception handling
libunwind: pc not in table, pc=0x7FF79EF8A78E
Access violation in generated code when executing data at 0x7ff79ef80000
Attempting to reconstruct a stack trace...
Frame Code address
* 0x91c98fd930 0x7ff79ef80000 C:\Users\winferno\Documents\Hacking\Haskell\staging\dist-newstyle\build\x86_64-windows\ghc-9.4.0.20220715\inline-c-cpp-0.5.0.0\t\tests\build\tests\tests.exe+0x0
* 0x91c98fd980 0x7ff79f9e3424 C:\Users\winferno\Documents\Hacking\Haskell\staging\dist-newstyle\build\x86_64-windows\ghc-9.4.0.20220715\inline-c-cpp-0.5.0.0\t\tests\build\tests\tests.exe+0xa63424
* 0x91c98fd9e0 0x7ff79f2f9a32 C:\Users\winferno\Documents\Hacking\Haskell\staging\dist-newstyle\build\x86_64-windows\ghc-9.4.0.20220715\inline-c-cpp-0.5.0.0\t\tests\build\tests\tests.exe+0x379a32
* 0x91c98fd9e8 0x7ff79ef8a78e C:\Users\winferno\Documents\Hacking\Haskell\staging\dist-newstyle\build\x86_64-windows\ghc-9.4.0.20220715\inline-c-cpp-0.5.0.0\t\tests\build\tests\tests.exe+0xa78e
* 0x91c98fd9f0 0x7ff9a0daf650 C:\Windows\System32\KERNEL32.DLL+0x1f650
* 0x91c98fd9f8 0x7ef400000000
* 0x91c98fda00 0x1c36ee0fed0
* 0x91c98fda08 0x7ef4e6206b50
* 0x91c98fda10 0x7ef4e6206f98
* 0x91c98fda18 0x6b006300610048
* 0x91c98fda20 0x5c0067006e0069
* 0x91c98fda28 0x6b007300610048
* 0x91c98fda30 0x5c006c006c0065
* 0x91c98fda38 0x67006100740073
* 0x91c98fda40 0x5c0067006e0069
* 0x91c98fda48 0x74007300690064
* 0x91c98fda50 0x770065006e002d
* 0x91c98fda58 0x7ef4e6206f80
* 0x91c98fda60 0x7ef4e5fceb03
* 0x91c98fda68 0x7ff7a0655a42 C:\Users\winferno\Documents\Hacking\Haskell\staging\dist-newstyle\build\x86_64-windows\ghc-9.4.0.20220715\inline-c-cpp-0.5.0.0\t\tests\build\tests\tests.exe+0x16d5a42
* 0x91c98fda70 0x7ef4e5fe5861
* 0x91c98fda78 0x800
Test suite tests: FAIL
Test suite logged to:
C:\Users\winferno\Documents\Hacking\Haskell\staging\dist-newstyle\build\x86_64-windows\ghc-9.4.0.20220715\inline-c-cpp-0.5.0.0\t\tests\test\inline-c-cpp-0.5.0.0-tests.log
0 of 1 test suites (0 of 1 test cases) passed.
Error: cabal.exe: Tests failed for test:tests from inline-c-cpp-0.5.0.0.
This does not occur on Linux, so I expect that the issue is due to something in GHC's runtime linker. While I have not yet had a chance to minimize the issue down to a minimal example, I suspect that the recent work on the runtime linker in !8619 (closed) may be involved.