Opened 9 years ago

Closed 4 years ago

Last modified 4 years ago

#5001 closed bug (fixed)

makeCorePair: arity missing

Reported by: maeder Owned by:
Priority: high Milestone: 7.4.1
Component: Compiler Version: 7.2.1
Keywords: Cc: michal.terepeta@…, ryan.gl.scott@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect warning at compile-time Test Case: deSugar/should_compile/T5001, rename/should_fail/T5001b
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

when compiling our hets sources with optimization I get unexpected messages like:

makeCorePair: arity missing $cmap_sentence{v au5bz} [lid]
makeCorePair: arity missing $cmap_symbol{v au5bC} [lid]

I think it is emitted by the desugarer i.e. for the source file http://trac.informatik.uni-bremen.de:8080/hets/browser/trunk/Comorphisms/OWL2CommonLogic.hs

I've noticed no consequences (bugs), though. Maybe it should only be emitted when a certain verbosity level is set.

Attachments (2)

Foo.hs (120 bytes) - added by igloo 8 years ago.
Bar.hs (395 bytes) - added by igloo 8 years ago.

Download all attachments as: .zip

Change History (29)

comment:1 Changed 9 years ago by igloo

Milestone: 7.2.1
Priority: normalhigh

Thanks for the report.

pprTrace looks like a very suspicious function to me. I'm not sure it ever makes sense to use it. Maybe -dno-debug-output should default to on unless in a -DDEBUG compiler?

comment:2 Changed 9 years ago by simonmar

I think having -dno-debug-output default to on is a very good idea. What do you mean by pprTrace being suspicious? Just the same reasons that trace is suspicious?

comment:3 Changed 9 years ago by igloo

I mean that, with -dno-debug-output off by default, I can't imagine a use of it that would make sense.

comment:4 Changed 9 years ago by simonpj

Status: newinfoneeded

There's definitely something wrong, although it's harmless I think. However

  • It's hard for me to reproduce because I don't much want to go through the process of building all of Hets
  • It's to do with default methods, which is being up-heaved by Pedro anyway

I think the best thing to do is to wait for 7.2, and try again then.

Meanwhile if you felt able to cut it down to a test case that'd be even better, but you may not want to bother since it's doing no harm meanwhile.

Simon

comment:5 Changed 9 years ago by michalt

Cc: michal.terepeta@… added

While checking another bug I've come across this one. Small example:

module M1 where

class MyEnum a where
  myEnum :: [a]

instance MyEnum () where
  {-# INLINABLE myEnum #-}
  myEnum = [()]
module M2 where

import M1

{-# SPECIALISE myEnum  :: [()] #-}

Compiling with HEAD gives:

~/bugs/ghc/4227 0 > ~/dev/ghc/inplace/bin/ghc-stage2 --make -O -fforce-recomp M2
[1 of 2] Compiling M1               ( M1.hs, M1.o )
[2 of 2] Compiling M2               ( M2.hs, M2.o )
makeCorePair: arity missing myEnum{v dcc} [lid]

Interestingly if I move the SPECIALISE pragma into M1 module, there is no warning:

module M1 where

class MyEnum a where
  myEnum :: [a]

instance MyEnum () where
  {-# INLINABLE myEnum #-}
  myEnum = [()]

{-# SPECIALISE myEnum  :: [()] #-}
~/bugs/ghc/4227 0 > ~/dev/ghc/inplace/bin/ghc-stage2 --make -O -fforce-recomp M1
[1 of 1] Compiling M1               ( M1.hs, M1.o )

comment:6 Changed 9 years ago by simonpj

Resolution: fixed
Status: infoneededclosed

I investigated michaelt's example. Your SPECIALISE pragmas for myEnum in M2 is for the class method

myEnum :: MyEnum a => [a]

But the class method is just a record selector, so specialising it doesn't make much sense. (The reason for the bleating message is related to it being a class method too, but that's an implementation detail.) So I've arranged to give a more helpful message if you try to specialise a class method.

commit 777b8c4bd6f8a76f2fd365aa43451b7af098e9ef
Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Mon Jun 13 15:03:38 2011 +0100

    Don't allow specialisation of class methods (fixes Trac #5001)
    
    It doesn't make sense to specialise class methods -- their
    code is simply a record selector.  Moreover, such methods
    don't (currently) have an inl_sat field in their InlinePragma
    which made DsBinds.makeCoreArity bleat.
    
    This patch just ignores such pragmas, with a warning.

>---------------------------------------------------------------

 compiler/deSugar/DsBinds.lhs |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

That done, I'm closing the ticket.

Simon

comment:7 Changed 8 years ago by maeder

Resolution: fixed
Status: closednew

The messages of the initial description still turn up with ghc-7.2.0.20110728

comment:8 in reply to:  7 Changed 8 years ago by michalt

Replying to maeder:

The messages of the initial description still turn up with ghc-7.2.0.20110728

Probably the patch just wasn't merged to the 7.2 branch.

comment:9 Changed 8 years ago by igloo

Milestone: 7.2.17.4.1
Status: newinfoneeded

The link in the summary seems to be broken. Can you give us instructions for how to reproduce the problem, please?

comment:10 Changed 8 years ago by igloo

Resolution: invalid
Status: infoneededclosed

No testcase, so closing.

comment:11 in reply to:  9 Changed 8 years ago by maeder

Resolution: invalid
Status: closednew

Replying to igloo:

The link in the summary seems to be broken. Can you give us instructions for how to reproduce the problem, please?

Sorry, I did not get this message. The file changed to http://trac.informatik.uni-bremen.de:8080/hets/browser/trunk/OWL2/OWL22CommonLogic.hs

I'll supply a better test-case later

comment:12 Changed 8 years ago by maeder

http://www.informatik.uni-bremen.de/agbkb/forschung/formal_methods/CoFI/hets/src-distribution/daily/Hets-0.98.tar.gz is a (large) package that exhibits the message

cabal install -f -uniform -f -programatica -f -gtkglade -f -hexpat -f -haskeline -f -sever -f -tar http://www.informatik.uni-bremen.de/agbkb/forschung/formal_methods/CoFI/hets/src-distribution/daily/Hets-0.98.tar.gz

...

[456 of 603] Compiling Comorphisms.Prop2QBF ( Comorphisms/Prop2QBF.hs, dist/build/hets/hets-tmp/Comorphisms/Prop2QBF.o )
[457 of 603] Compiling Comorphisms.CommonLogic_ModuleElimination ( Comorphisms/CommonLogic_ModuleElimination.hs, dist/build/hets/hets-tmp/Comorphisms/CommonLogic_ModuleElimination.o )
makeCorePair: arity missing $cmap_symbol{v avUa9} [lid]
[458 of 603] Compiling Comorphisms.Prop2CommonLogic ( Comorphisms/Prop2CommonLogic.hs, dist/build/hets/hets-tmp/Comorphisms/Prop2CommonLogic.o )
makeCorePair: arity missing $cmap_symbol{v avV3A} [lid]
[459 of 603] Compiling Comorphisms.SoftFOL2CommonLogic ( Comorphisms/SoftFOL2CommonLogic.hs, dist/build/hets/hets-tmp/Comorphisms/SoftFOL2CommonLogic.o )

Comorphisms/SoftFOL2CommonLogic.hs:34:1:
    Warning: In the use of `Map.foldWithKey'
             (imported from Data.Map):
             Deprecated: "Use foldrWithKey instead"
makeCorePair: arity missing $cmap_symbol{v avVGP} [lid]
[460 of 603] Compiling OWL2.DMU2OWL2    ( OWL2/DMU2OWL2.hs, dist/build/hets/hets-tmp/OWL2/DMU2OWL2.o )
makeCorePair: arity missing $cmap_sentence{v avYc9} [lid]
makeCorePair: arity missing $cmap_symbol{v avYcc} [lid]
[461 of 603] Compiling OWL2.OWL22CommonLogic ( OWL2/OWL22CommonLogic.hs, dist/build/hets/hets-tmp/OWL2/OWL22CommonLogic.o )
makeCorePair: arity missing $cmap_sentence{v avZIZ} [lid]
[462 of 603] Compiling OWL2.Propositional2OWL2 ( OWL2/Propositional2OWL2.hs, dist/build/hets/hets-tmp/OWL2/Propositional2OWL2.o )
makeCorePair: arity missing $cmap_morphism{v awcgs} [lid]
makeCorePair: arity missing $cmap_sentence{v awcgv} [lid]
makeCorePair: arity missing $cmap_symbol{v awcgy} [lid]

comment:13 Changed 8 years ago by maeder

Version: 7.0.27.2.1

comment:14 Changed 8 years ago by simonpj

Owner: set to simonpj

Changed 8 years ago by igloo

Attachment: Foo.hs added

Changed 8 years ago by igloo

Attachment: Bar.hs added

comment:15 Changed 8 years ago by igloo

With Foo.hs and Bar.hs (both attached) and HEAD:

$ ghc --make Foo.hs -O -fforce-recomp
[1 of 2] Compiling Bar              ( Bar.hs, Bar.o )
[2 of 2] Compiling Foo              ( Foo.hs, Foo.o )
makeCorePair: arity missing
    ( $cmap_sentence{v ajG} [lid] :: ghc-prim:GHC.Types.Float{(w) tc 3A}
                                     -> ghc-prim:GHC.Types.Int{(w) tc 3J}
                                     -> ghc-prim:GHC.Types.Char{(w) tc 3o}
                                     -> main:Bar.Result{tc r4} main:Foo.T{tc rjx} )

comment:16 Changed 8 years ago by simonpj@…

commit e704a95889681bd58e0a7cebfcc0e98193e46343

Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Sun Nov 27 19:44:19 2011 +0000

    Don't indirection-zap a function that has a stable unfolding
    
    This was responsible for Trac #5001, and it was a real bug;
    an inlining could be lost.

 compiler/simplCore/SimplCore.lhs |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

comment:17 Changed 8 years ago by simonpj

Status: newinfoneeded
Test Case: deSugar/should_compile/T5001

Useful bug thank you. I've fixed the program that Ian boiled out, and made it into a regression test. Does that fix your original program?

Simon

comment:18 Changed 8 years ago by maeder

Thanks for the fix. I'll need a snapshot distribution to test it, though.

comment:19 Changed 8 years ago by maeder

It works with ghc-7.4.0.20111219 for me, thanks again!

comment:20 Changed 8 years ago by simonpj

difficulty: Unknown
Resolution: fixed
Status: infoneededclosed

comment:21 Changed 5 years ago by nomeata

Owner: simonpj deleted
Resolution: fixed
Status: closednew

Not fully fixed yet. I just observed this when compiling mono-traversable-0.6.2 using GHC-7.8.4-rc1:

[2 of 7] Compiling Data.MonoTraversable ( src/Data/MonoTraversable.hs, dist-ghc/build/Da
ta/MonoTraversable.o )

src/Data/MonoTraversable.hs:39:1: Warning:
    The import of `$, replicate' from module `Prelude' is redundant
makeCorePair: arity missing $cofoldMap{v aaQ1} [lid]

comment:22 Changed 5 years ago by RyanGlScott

Cc: ryan.gl.scott@… added

comment:23 Changed 4 years ago by thomie

Here is a test to reproduce the problem from comment:21.

{-# LANGUAGE DefaultSignatures #-}
module T5001b where

class GEnum a where
    genum :: [a]
    default genum :: [a]
    genum = undefined

instance GEnum Int where
    {-# INLINE genum #-}
$ ghc-7.10.2 T5001b.hs
[1 of 1] Compiling T5001b           ( T5001b.hs, T5001b.o )
makeCorePair: arity missing $cgenum_am5

comment:24 Changed 4 years ago by Simon Peyton Jones <simonpj@…>

In 72d23c3/ghc:

Better treatment of signatures in cls/inst

The provoking cause for this patch is Trac #5001, comment:23.  There
was an INLINE pragma in an instance decl, that shouldn't be there.
But there was no complaint, just a  mysterious WARN later.

I ended up having to do some real refactoring but the result is,
I think, simpler and more robust.

comment:25 Changed 4 years ago by simonpj

Resolution: fixed
Status: newclosed
Test Case: deSugar/should_compile/T5001deSugar/should_compile/T5001, rename/should_fail/T5001

OK, I've fixed this.

mono-traversable is in error, and GHC properly reports it now: on line 514 of MonoTraversable.hs we have

    {-# INLINE ofoldMap #-}

but there is no corresponding method binding in that instance declaration. So that needs fixing in mono-traversable.

Meanwhile I'll close the ticket. Thanks for the nice small test case.

It's pretty harmless so no need to merge to 7.10.

I added another test in rename/should_fail/T5001, not realising that we already have deSugar/should_compile/T5001. But that's fine, they don't conflict and test different things.

Simon

comment:26 Changed 4 years ago by Thomas Miedema <thomasmiedema@…>

In b5097fe/ghc:

Testsuite: rename rename/should_fail/T5001 to T5001b (#5001)

Test names should be unique. This fixes a framework failure.

comment:27 Changed 4 years ago by thomie

Test Case: deSugar/should_compile/T5001, rename/should_fail/T5001deSugar/should_compile/T5001, rename/should_fail/T5001b
Note: See TracTickets for help on using tickets.