From 92a2a3c2b433813e79c9a59f3b44a931b758ae2c Mon Sep 17 00:00:00 2001
From: panne <unknown>
Date: Mon, 12 Jun 2000 18:13:20 +0000
Subject: [PATCH] [project @ 2000-06-12 18:13:20 by panne] `foreign label foo
 :: Addr' was simply mapped to `foo' on the C side, but this is wrong, resp.
 only works for C *functions*, not *variables* (praise the implicit
 conversions of C!). It now correctly maps to `(&foo)'.

ATTENTION: I'm not sure if this fix breaks some SW which depends on
the old (wrong) behaviour (H/Direct?).
---
 ghc/compiler/deSugar/DsForeign.lhs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ghc/compiler/deSugar/DsForeign.lhs b/ghc/compiler/deSugar/DsForeign.lhs
index f6b7cb6c2939..b0d3fb0a049f 100644
--- a/ghc/compiler/deSugar/DsForeign.lhs
+++ b/ghc/compiler/deSugar/DsForeign.lhs
@@ -171,8 +171,9 @@ Foreign labels
 dsFLabel :: Id -> ExtName -> DsM CoreBind
 dsFLabel nm ext_name = returnDs (NonRec nm fo_rhs)
   where
-   fo_rhs = mkConApp addrDataCon [mkLit (MachLitLit enm addrPrimTy)]
+   fo_rhs = mkConApp addrDataCon [mkLit (MachLitLit addr addrPrimTy)]
    enm    = extNameStatic ext_name
+   addr   = SLIT("(&") _APPEND_ enm _APPEND_ SLIT(")")
 \end{code}
 
 The function that does most of the work for `@foreign export@' declarations.
-- 
GitLab