Confusing warnings from GHC HEAD

I get a few dozen of these when building the text package, and they weren't present in 6.12 or earlier: SpecConstr Function `$wa1{v X5A2} [lid]' has three call patterns, but the limit is 2 Use -fspec-constr-count=n to set the bound Use -dppr-debug to see specialisations There are a few aspects to this that I find surprising. - I can't do anything with the Core name. - My cabal file contains -fspec-constr-count=5 just to be safe, but it doesn't help. I can't tell whether this is the compiler going a little off into the weeds, or whether I'm doing something wrong, but I appear to be unable to make the message go away. Thanks, Bryan.

I can’t reproduce this. With the enclosed module and HEAD, I get the warning; but when I add –fspec-constr-count=5, the warning goes away and I get the specialised rules. Could Cabal not be passing on the flag or something? Simon module Foo where data T = A | B | C | D | E f :: T -> [Bool] -> T f x ys | and ys = x f A ys = f B ys f B ys = f C ys f C ys = f D ys f D ys = f E ys f E ys = f A ys From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell-users-bounces@haskell.org] On Behalf Of Bryan O'Sullivan Sent: 29 August 2010 01:05 To: glasgow-haskell-users@haskell.org Subject: Confusing warnings from GHC HEAD I get a few dozen of these when building the text package, and they weren't present in 6.12 or earlier: SpecConstr Function `$wa1{v X5A2} [lid]' has three call patterns, but the limit is 2 Use -fspec-constr-count=n to set the bound Use -dppr-debug to see specialisations There are a few aspects to this that I find surprising. * I can't do anything with the Core name. * My cabal file contains -fspec-constr-count=5 just to be safe, but it doesn't help. I can't tell whether this is the compiler going a little off into the weeds, or whether I'm doing something wrong, but I appear to be unable to make the message go away. Thanks, Bryan.

On Tue, Aug 31, 2010 at 11:06 AM, Simon Peyton-Jones
I can’t reproduce this. With the enclosed module and HEAD, I get the warning; but when I add –fspec-constr-count=5, the warning goes away and I get the specialised rules.
Is this the right fix in general? I try to keep my code warning free but I don't want to bump the count unless it's always a win. If it's not always a win perhaps it should be a warning that's on by default? -- Johan

It's a bit of a moveable feast. With -fno-spec-constr-count you allow GHC to specialise as much as it pleases, which is good for perf (maybe) but can lead to major code size expansion.
S
From: Johan Tibell [mailto:johan.tibell@gmail.com]
Sent: 31 August 2010 10:16
To: Simon Peyton-Jones
Cc: Bryan O'Sullivan; glasgow-haskell-users@haskell.org
Subject: Re: Confusing warnings from GHC HEAD
On Tue, Aug 31, 2010 at 11:06 AM, Simon Peyton-Jones

On Tue, Aug 31, 2010 at 2:06 AM, Simon Peyton-Jones
I can’t reproduce this. With the enclosed module and HEAD, I get the warning; but when I add –fspec-constr-count=5, the warning goes away and I get the specialised rules.
Could Cabal not be passing on the flag or something?
I see -fspec-constr-count=5 in the command line being passed to ghc when I run "cabal build -v", so I don't think that's to blame?

On Tue, Aug 31, 2010 at 09:11:13PM -0700, Bryan O'Sullivan wrote:
On Tue, Aug 31, 2010 at 2:06 AM, Simon Peyton-Jones
wrote: I can’t reproduce this. With the enclosed module and HEAD, I get the warning; but when I add –fspec-constr-count=5, the warning goes away and I get the specialised rules.
Could Cabal not be passing on the flag or something?
I see -fspec-constr-count=5 in the command line being passed to ghc when I run "cabal build -v", so I don't think that's to blame?
I've filed a ticket for this, with a standalone testcase, here: http://hackage.haskell.org/trac/ghc/ticket/4288 Thanks Ian

On Tue, Aug 31, 2010 at 2:06 AM, Simon Peyton-Jones
I can’t reproduce this. With the enclosed module and HEAD, I get the warning; but when I add –fspec-constr-count=5, the warning goes away and I get the specialised rules.
The compiler behaves as expected on your code, but not on mine. I've verified that the -fspec-constr-count argument is indeed being passed along by Cabal to ghc. In my case, building with -fspec-constr-count=10 eliminates the warnings on most of the functions where the Core name corresponds to something I can see in the source, so almost half the SpecConstr warnings go away. So, for instance, this one goes away when I increase the count: Function `$wconsume{v s1RPo} [lid]' has five call patterns, but the limit is 3 However, several warnings remain, and the Core names are unidentifiable. More strangely, the SpecConstr limit reported in the warnings changes from one warning to the next, even within the sequence of warnings emitted during the compilation of a single file. Here's an excerpt from compiling only Data.Text: Function `$wa1{v Xvnq} [lid]' has one call pattern, but the limit is 0 Function `$w$j{v Xvob} [lid]' has two call patterns, but the limit is 1 Function `$wa1{v Xvov} [lid]' has three call patterns, but the limit is 2 This suggests to me that maybe some config information is being changed in error somewhere?
participants (4)
-
Bryan O'Sullivan
-
Ian Lynagh
-
Johan Tibell
-
Simon Peyton-Jones