Opened 11 years ago

Closed 10 years ago

#2824 closed bug (fixed)

Duplicate symbols generated when Generics flag and syb-with-class "derive" used simultaneously

Reported by: jcheney Owned by:
Priority: normal Milestone: 6.12.1
Component: Template Haskell Version: 6.10.1
Keywords: generics, syb-with-class Cc:
Operating System: Linux Architecture: x86
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Attached file Foo.hs compiles fine using

ghc -c Foo.hs

But compiling using the -XGenerics flag yields duplicate symbols errors from the assembler:

jcheney@oreb:~/src/FreshLib/bug$ ghc -c -v -XGenerics Foo.hs
Glasgow Haskell Compiler, Version 6.10.1, for Haskell 98, stage 2 booted by GHC version 6.6
Using package config file: /usr/local/lib/ghc-6.10.1/./package.conf
Using package config file: /home/jcheney/.ghc/i386-linux-6.10.1/package.conf
hiding package base- to avoid conflict with later version base-
wired-in package ghc-prim mapped to ghc-prim-
wired-in package integer mapped to integer-
wired-in package base mapped to base-
wired-in package rts mapped to rts-1.0
wired-in package haskell98 mapped to haskell98-
wired-in package syb mapped to syb-
wired-in package template-haskell mapped to template-haskell-
wired-in package dph-seq mapped to dph-seq-0.3
wired-in package dph-par mapped to dph-par-0.3
Hsc static flags: -static
Created temporary directory: /tmp/ghc15945_0
*** Checking old interface for main:Foo:
*** Parser:
*** Renamer/typechecker:
*** Simplify:
*** CorePrep:
*** ByteCodeGen:
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Loading package syb ... linking ... done.
Loading package base- ... linking ... done.
Loading package array- ... linking ... done.
Loading package packedstring- ... linking ... done.
Loading package containers- ... linking ... done.
Loading package pretty- ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package bytestring- ... linking ... done.
Loading package syb-with-class-0.4 ... linking ... done.
*** Desugar:
    Result size = 230
*** Simplify:
    Result size = 141
    Result size = 141
*** Tidy Core:
    Result size = 141
writeBinIface: 9 Names
writeBinIface: 42 dict entries
*** CorePrep:
    Result size = 187
*** Stg2Stg:
*** CodeGen:
*** CodeOutput:
*** Assembler:
gcc -I. -c /tmp/ghc15945_0/ghc15945_0.s -o Foo.o
/tmp/ghc15945_0/ghc15945_0.s: Assembler messages:

     Error: symbol `Foo_zdgtoFoo_closure' is already defined

     Error: symbol `Foo_zdgtoFoo_info' is already defined

     Error: symbol `Foo_zdgfromFoo_closure' is already defined

     Error: symbol `Foo_zdgfromFoo_info' is already defined
*** Deleting temp files:
Deleting: /tmp/ghc15945_0/ghc15945_0.s
*** Deleting temp dirs:
Deleting: /tmp/ghc15945_0

Attachments (1)

Foo.hs (430 bytes) - added by jcheney 11 years ago.

Download all attachments as: .zip

Change History (4)

Changed 11 years ago by jcheney

Attachment: Foo.hs added

comment:1 Changed 11 years ago by igloo

Component: CompilerTemplate Haskell
difficulty: Unknown
Milestone: 6.10.2

Here's a minimal testcase:

{-# LANGUAGE TemplateHaskell #-}

module Foo where

data D = C
        instance Show D where
            show _ = "Wibble" 

Here with 6.11.20081205:

$ ghc -c b.hs -fforce-recomp -v0
$ ghc -c b.hs -fforce-recomp -v0 -XGenerics
/tmp/ghc15834_0/ghc15834_0.s: Assembler messages:

     Error: symbol `Foo_zdgtoD_closure' is already defined

     Error: symbol `Foo_zdgtoD_info' is already defined

     Error: symbol `Foo_zdgfromD_closure' is already defined

     Error: symbol `Foo_zdgfromD_info' is already defined

comment:2 Changed 10 years ago by igloo


comment:3 Changed 10 years ago by igloo

Resolution: fixed
Status: newclosed
Type of failure: None/Unknown

I can no longer reproduce this in the 6.12 branch or HEAD.

Note: See TracTickets for help on using tickets.