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:

Description

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-3.0.3.0 to avoid conflict with later version base-4.0.0.0
wired-in package ghc-prim mapped to ghc-prim-0.1.0.0
wired-in package integer mapped to integer-0.1.0.0
wired-in package base mapped to base-4.0.0.0
wired-in package rts mapped to rts-1.0
wired-in package haskell98 mapped to haskell98-1.0.1.0
wired-in package syb mapped to syb-0.1.0.0
wired-in package template-haskell mapped to template-haskell-2.3.0.0
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-3.0.3.0 ... linking ... done.
Loading package array-0.2.0.0 ... linking ... done.
Loading package packedstring-0.1.0.1 ... linking ... done.
Loading package containers-0.2.0.0 ... linking ... done.
Loading package pretty-1.0.1.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package bytestring-0.9.1.4 ... 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:

/tmp/ghc15945_0/ghc15945_0.s:224:0:
     Error: symbol `Foo_zdgtoFoo_closure' is already defined

/tmp/ghc15945_0/ghc15945_0.s:233:0:
     Error: symbol `Foo_zdgtoFoo_info' is already defined

/tmp/ghc15945_0/ghc15945_0.s:273:0:
     Error: symbol `Foo_zdgfromFoo_closure' is already defined

/tmp/ghc15945_0/ghc15945_0.s:291:0:
     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
$(
    [d| 
        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:

/tmp/ghc15834_0/ghc15834_0.s:22:0:
     Error: symbol `Foo_zdgtoD_closure' is already defined

/tmp/ghc15834_0/ghc15834_0.s:31:0:
     Error: symbol `Foo_zdgtoD_info' is already defined

/tmp/ghc15834_0/ghc15834_0.s:77:0:
     Error: symbol `Foo_zdgfromD_closure' is already defined

/tmp/ghc15834_0/ghc15834_0.s:95:0:
     Error: symbol `Foo_zdgfromD_info' is already defined
$

comment:2 Changed 10 years ago by igloo

Milestone: 6.10.26.12.1

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.