Opened 6 years ago

Closed 6 years ago

#2543 closed bug (duplicate)

Nested SPECIALIZEd functions cause error: "Symbol _BadUTF8_zdf1_closure already defined."

Reported by: judah Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.9
Keywords: Cc:
Operating System: MacOS X Architecture: x86
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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.

Change History (1)

comment:1 Changed 6 years ago by simonpj

  • Difficulty set to Unknown
  • Resolution set to duplicate
  • Status changed from new to closed

Dup of #2520. Thanks for another test case.

Simon

Note: See TracTickets for help on using tickets.