From 10499f55166e1906b6bdfd3576b0f3b8c019cc91 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Fri, 1 Jan 2021 17:31:48 -0500 Subject: compiler: Initialize ForeignExportsList.n_entries The refactoring in ed57c3a9eb9286faa222f98e484a9ef3432b2025 failed to initialize this field, resulting in no exports being registered. A very silly bug and yet somehow none of our tests caught it. See #18548. Fixes #19149. --- compiler/GHC/HsToCore/Foreign/Decl.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/GHC/HsToCore/Foreign/Decl.hs b/compiler/GHC/HsToCore/Foreign/Decl.hs index 1dea63982f..8348d0a1fa 100644 --- a/compiler/GHC/HsToCore/Foreign/Decl.hs +++ b/compiler/GHC/HsToCore/Foreign/Decl.hs @@ -715,7 +715,10 @@ foreignExportsInitialiser mod hs_fns = -- See Note [Tracking foreign exports] in rts/ForeignExports.c vcat [ text "static struct ForeignExportsList" <+> list_symbol <+> equals - <+> braces (text ".exports = " <+> export_list) <> semi + <+> braces ( + text ".exports = " <+> export_list <> comma <+> + text ".n_entries = " <+> ppr (length hs_fns)) + <> semi , text "static void " <> ctor_symbol <> text "(void)" <+> text " __attribute__((constructor));" , text "static void " <> ctor_symbol <> text "()" -- cgit v1.2.1