[GHC] #2543: Nested SPECIALIZEd functions cause error: "Symbol _BadUTF8_zdf1_closure already defined."

GHC trac at galois.com
Mon Aug 25 14:03:48 EDT 2008


#2543: Nested SPECIALIZEd functions cause error: "Symbol _BadUTF8_zdf1_closure
already defined."
-----------------------+----------------------------------------------------
    Reporter:  judah   |       Owner:          
        Type:  bug     |      Status:  new     
    Priority:  normal  |   Component:  Compiler
     Version:  6.9     |    Severity:  normal  
    Keywords:          |    Testcase:          
Architecture:  x86     |          Os:  MacOS X 
-----------------------+----------------------------------------------------
 The `utf8-string` package (in particular, the module
 `Code.Binary.UTF8.Generic`) does not compile under ghc-6.9.20080825.

 I tried stripping down that module and believe the problem occurs when a
 SPECIALIZEd function calls another SPECIALIZEd function:

 {{{
 {-# LANGUAGE FlexibleInstances #-}
 module BadUTF8 where

 import Data.Word

 class UTF8Bytes b where

 instance UTF8Bytes [Word8] where

 {-# SPECIALIZE myfoldr :: (Char -> a -> a) -> a -> [Word8]      -> a #-}
 myfoldr :: UTF8Bytes b => (Char -> a -> a) -> a -> b -> a
 myfoldr _ x _ = x

 {-# SPECIALIZE toString :: [Word8] -> String #-}
 toString :: UTF8Bytes b => b -> String
 toString bs = myfoldr (:) [] bs
 }}}

 Compiling using ghc-6.9.20080825 without -O, or ghc-6.8.3 with or without
 -O, does not produce an error.  However, ghc-6.9.20080825 with
 optimization produces:

 {{{
 judah-jacobsons-computer:tmp judah$ ~/tmp/ghc-stage/bin/ghc --make -O
 BadUTF8.hs
 [1 of 1] Compiling BadUTF8          ( BadUTF8.hs, BadUTF8.o )

 /var/folders/Pm/Pm4yd68oG4qqe-
 gsgn56W++++TI/-Tmp-/ghc88501_0/ghc88501_0.s:81:0:
     FATAL:Symbol _BadUTF8_zdf1_closure already defined.
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2543>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list