4 years agoFix #10182 by disallowing/avoiding self {-# SOURCE #-} imports
Edward Z. Yang [Tue, 21 Apr 2015 13:46:32 +0000 (06:46 -0700)] 
Fix #10182 by disallowing/avoiding self {-# SOURCE #-} imports

hs-boot declarations were leaking into the EPS due to
self {-# SOURCE #-} imports, and interface loading induced by
orphan instances.  For the former, we simply disallow self
{-# SOURCE #-} imports; for the latter, we simply just don't
load an interface if it would be ourself.

Signed-off-by: Edward Z. Yang <>
Test Plan: validate

Reviewers: simonpj, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10182

4 years agoDon't use self {-# SOURCE #-} import in test-cases.
Edward Z. Yang [Tue, 21 Apr 2015 17:26:25 +0000 (10:26 -0700)] 
Don't use self {-# SOURCE #-} import in test-cases.

It's kind of buggy, c.f. #10182, and isn't motivated by any
real world programs, so we're going to get rid of it (despite
it being handy for GHC test cases.)

Signed-off-by: Edward Z. Yang <>
Test Plan: validate

Reviewers: simonpj, austin

Subscribers: thomie

Differential Revision:

4 years agoMark T8743 as passing
Joachim Breitner [Wed, 22 Apr 2015 09:07:37 +0000 (11:07 +0200)] 
Mark T8743 as passing

as Simons recent commit 9b9fc4c732baab126b057b4031bebcbd67d6e348 fixed

4 years agoDo not decompose => (Trac #9858)
Simon Peyton Jones [Wed, 22 Apr 2015 08:45:52 +0000 (09:45 +0100)] 
Do not decompose => (Trac #9858)

We really don't want to unify (a b) with (Eq a => ty).
The ever-ingenious Oerjan discovered this problem;
see comment:101 in Trac #9858.

See Note [Decomposing fat arrow c=>t] in Type.hs

4 years agoFix the boot dfun impedence-matching binding
Simon Peyton Jones [Wed, 22 Apr 2015 08:29:24 +0000 (09:29 +0100)] 
Fix the boot dfun impedence-matching binding

In TcRnDriver.checkHiBootIface' we were generating an
impedence-matching binding
   $fxToRecMaybe = $fToRecMaybe
but the type of the former was gotten from the *hi-boot*
file, so its type constructor was not fully fleshed out.
That should never happen.

Fix is easy, happily.  A dark corner.

4 years agoAdd a blank line
Simon Peyton Jones [Wed, 22 Apr 2015 06:48:18 +0000 (07:48 +0100)] 
Add a blank line

4 years agoUse the gold linker for aarch64/linux (#9673)
Erik de Castro Lopo [Mon, 20 Apr 2015 20:22:44 +0000 (20:22 +0000)] 
Use the gold linker for aarch64/linux (#9673)

Like 32 bit Arm, Aarch64 requires use of the gold linker.

Signed-off-by: Erik de Castro Lopo <>
Test Plan: 'make install' on aarch64, validate elsewhere

Reviewers: rwbarton, bgamari, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #9673

4 years agoEnable SMP and GHCi support for Aarch64
Erik de Castro Lopo [Wed, 1 Apr 2015 04:46:01 +0000 (04:46 +0000)] 
Enable SMP and GHCi support for Aarch64

Signed-off-by: Erik de Castro Lopo <>
Test Plan: Full build on Aarch64

Reviewers: rwbarton, bgamari, austin

Subscribers: thomie

Differential Revision:

4 years agoGADTs now are CPR-able
Simon Peyton Jones [Tue, 21 Apr 2015 08:54:03 +0000 (09:54 +0100)] 
GADTs now are CPR-able

Accompanies f2d1b7fcbbc55e33375a7321222a9f4ee189aa38
Support unboxing for GADT product types

4 years agoWibble to DmdAnal
Simon Peyton Jones [Tue, 21 Apr 2015 08:29:13 +0000 (09:29 +0100)] 
Wibble to DmdAnal

This fixes a typo in d5773a4939b1feea51ec0db6624c9462751e948a
    Teach DmdAnal that coercions are value arguments!
    (Trac #10288)

Sorry about that; I'm not sure how it slipped through.

4 years agoSupport unboxing for GADT product types
Simon Peyton Jones [Mon, 20 Apr 2015 15:00:49 +0000 (16:00 +0100)] 
Support unboxing for GADT product types

Beofre this commit we never unboxed GADT, even if they
are perfectly civilised products.

This patch liberalises unboxing slightly.
See Note [Product types] in TyCon.

Still to come
 - for strictness, we could maybe deal with existentials too
 - todo: unboxing constructor arguments

4 years agoSpelling in comment
Simon Peyton Jones [Mon, 20 Apr 2015 14:58:31 +0000 (15:58 +0100)] 
Spelling in comment

4 years agoTeach DmdAnal about free coercion variables
Simon Peyton Jones [Mon, 20 Apr 2015 14:57:54 +0000 (15:57 +0100)] 
Teach DmdAnal about free coercion variables

Coercion variables are used in casts and coercions, so the demand
analyser should jolly well not regard them as absent!

In fact this bug never makes a difference because even absent
unboxed-coercion arguments are passed anyway;
see WwLib.mk_abesnt_let, which returns Nothing for coercion Ids.

But it was simply wrong before and that is never cool.

4 years agoTeach DmdAnal that coercions are value arguments!
Simon Peyton Jones [Mon, 20 Apr 2015 14:43:32 +0000 (15:43 +0100)] 
Teach DmdAnal that coercions are value arguments!

The demand analyser was treating coercion args like type args,
which meant that the arguments in a strictness signature got
out of step with the arguments of a call.  Result chaos and
disaster.  Trac #10288 showed it up.

It's hard to get this bug to show up in practice because
 - functions abstracted over coercions are usually abstracted
   over *boxed* coercions
 - we don't currently unbox a boxed-coercion arg because it's
   GADT (I see how to fix this too)

But after floating, optimisation, and so on, Trac #10288 did
get a function abstracted over an unboxed coercion, and then
the -flate-dmd-anal pass went wrong.

I don't think I can come up with a test case, but I don't think
it matters too much.

Still to come
 - Fix a second bug, namely that coercion variables are wrongly
   marked as absent because DmdAnal doesn't check the the free
   variables of casts. I think this never bites in practice
   (see the follow-up commit)

 - Make GADT products work with strictness analysis

4 years agoUpdate Cabal submodule to release
Herbert Valerio Riedel [Mon, 20 Apr 2015 14:19:53 +0000 (16:19 +0200)] 
Update Cabal submodule to release

Highlights since

- cabal check will fail on -fprof-auto passed as a ghc-option
- filterConfigureFlags: filter more flags.
- fix ghcjs-pkg version number handling

Addresses #10304

4 years agoTest case for indirect dependencies in ghci linker (#10322)
Reid Barton [Wed, 15 Apr 2015 20:46:47 +0000 (16:46 -0400)] 
Test case for indirect dependencies in ghci linker (#10322)

4 years agoMake T9579 parallel-safe and add build outputs to .gitignore
Edward Z. Yang [Fri, 17 Apr 2015 10:14:41 +0000 (03:14 -0700)] 
Make T9579 parallel-safe and add build outputs to .gitignore

Signed-off-by: Edward Z. Yang <>
4 years agoStub out pkgState with non-error, helps with debugging.
Edward Z. Yang [Mon, 6 Apr 2015 18:32:14 +0000 (11:32 -0700)] 
Stub out pkgState with non-error, helps with debugging.

When we use -dppr-debug, we'll sometimes attempt to
hit the pkgState to give more detailed information.  It's pretty
annoying to have this fail because we haven't filled in the
pkgState: we can still get useful debugging information by
printing the raw package key.  To avoid this, we just put
in some empty stub pkgState, to be filled in later.

Signed-off-by: Edward Z. Yang <>
Test Plan: validate

Reviewers: simonpj, austin

Subscribers: thomie

Differential Revision:

4 years agoComments only.
Edward Z. Yang [Tue, 7 Apr 2015 20:38:52 +0000 (13:38 -0700)] 
Comments only.

Signed-off-by: Edward Z. Yang <>
Test Plan: comments only

Reviewers: simonpj, austin, goldfire

Subscribers: thomie

Differential Revision:

4 years agoDocumentation for rnImports/rnImportDecl.
Edward Z. Yang [Fri, 3 Apr 2015 03:59:07 +0000 (20:59 -0700)] 
Documentation for rnImports/rnImportDecl.

Signed-off-by: Edward Z. Yang <>
Test Plan: comments only

Reviewers: simonpj, austin

Subscribers: thomie

Differential Revision:

4 years agoBetter hints when RTS options not available (Trac #9579)
Javran Cheng [Fri, 17 Apr 2015 00:52:00 +0000 (10:52 +1000)] 
Better hints when RTS options not available (Trac #9579)

This patch provides user with a better hint when most RTS options
are not available (not compiled with `-rtsopts`).

A new field "rtsOptsEnabled" is added into RtsFlags.MiscFlags to
tell the availablity of RTS options.

Some concerns:
* Unlike other flag fields in "libraries/base/GHC/RTS/Flags.hsc",
  "RtsOptsEnabled" is defined in "includes/RtsAPI.h" and lacks
  constant macros. Therefore In "GHC.RTS", "RtsOptsEnabled" simply
  derives Enum instance and reads as of type "CInt".

* There are other ways to change RTS options (e.g. `-with-rtsopts`),
  but it might be too verbose to mention.

Test Plan: validate

Reviewers: austin, hvr, thomie, simonmar

Reviewed By: thomie

Subscribers: thomie, rwbarton

Differential Revision:

GHC Trac Issues: #9579

4 years agoRename tests so that they have a unique name.
Iavor S. Diatchki [Thu, 16 Apr 2015 21:29:07 +0000 (14:29 -0700)] 
Rename tests so that they have a unique name.

4 years agoFix test output
Iavor S. Diatchki [Thu, 16 Apr 2015 19:45:01 +0000 (12:45 -0700)] 
Fix test output

4 years agoFix test output.
Iavor S. Diatchki [Thu, 16 Apr 2015 19:41:16 +0000 (12:41 -0700)] 
Fix test output.

4 years agoFixes (hopefully!) T9858
Iavor S. Diatchki [Thu, 16 Apr 2015 18:13:24 +0000 (11:13 -0700)] 
Fixes (hopefully!) T9858

The changes are:
  1. No impredicative types in `Typeable`
  2. Distinguish normal tuples, from tuples of constraints.

4 years agoAdd exception for `KnownNat` and `KnownSymbol` in super classes.
Iavor S. Diatchki [Thu, 16 Apr 2015 16:47:28 +0000 (09:47 -0700)] 
Add exception for `KnownNat` and `KnownSymbol` in super classes.

The situation is similar to `Typeable`---we can't set the evidence
outside the solver because we have custom solving rules.  This is safe
because the computed super-class instances can't possibly depend
on the new instance.

4 years agoCall Arity: Trade precision for performance in large mutually recursive groups
Joachim Breitner [Wed, 15 Apr 2015 14:25:13 +0000 (16:25 +0200)] 
Call Arity: Trade precision for performance in large mutually recursive groups

Sometimes (especial with derived Data instances, it seems), one can have
very large mutually recursive bindings. Calculating the Call Arity
analysis result with full precision is an expensive operation in these
case. So above a certain threshold (25, for no good reason besides
intuition), skip this calculation and assume the recursion is not
linear, which is a conservative result.

With this, the Call Arity analysis accounts for 3.7% of the compile time
of haskell-src-exts. Fixes #10293

Differential Revision:

4 years agoImprove Call Arity performance
Joachim Breitner [Wed, 15 Apr 2015 11:32:32 +0000 (13:32 +0200)] 
Improve Call Arity performance

This improves how the Call Arity deals with "boring" variables. Boring
variables are those where it does not bother to include in the analysis
result, so whenever something is looked up in the analysis result, we
have to make a conservative assumption about them.

Previously, we extended the result with such conservative information
about them, to keep the code uniform, but that could blow up the amount
of data passed around, even if only temporarily, and slowed things down.

We now pass around an explicit list (well, set) of variable that are
boring and take that into account whenever we use the result. Not as
pretty, but noticably faster.

4 years agoFix fundep coverage-condition check for poly-kinds
Simon Peyton Jones [Wed, 15 Apr 2015 09:28:40 +0000 (10:28 +0100)] 
Fix fundep coverage-condition check for poly-kinds

See Note [Closing over kinds in coverage] in FunDeps.
I'd already fixed this bug once, for Trac #8391, but I put the
call to closeOverKinds in the wrong place, so Trac #10109
failed.  (It checks the /liberal/ coverage condition, which

The fix was easy: move the call to the right place!

4 years agoDo not allow Typeable on constraints (Trac #9858)
Simon Peyton Jones [Tue, 14 Apr 2015 14:39:01 +0000 (15:39 +0100)] 
Do not allow Typeable on constraints (Trac #9858)

The astonishingly-ingenious trio of
Shachaf Ben-Kiki, Ørjan Johansen and Nathan van Doorn
managed to persuade GHC 7.10.1 to cough up unsafeCoerce.

That is very bad. This patch fixes it by no allowing Typable
on Constraint-kinded things.  And that seems right, since
it is, in effect, a form of impredicative polymorphism,
which Typeable definitely doesn't support.

We may want to creep back in the direction of allowing
Typeable on constraints one day, but this is a good
fix for now, and closes a terrible hole.

4 years agoImplement -f[no-]print-unicode-syntax flag for unicode syntax output (#8959)
Bertram Felgenhauer [Tue, 14 Apr 2015 14:10:52 +0000 (09:10 -0500)] 
Implement -f[no-]print-unicode-syntax flag for unicode syntax output (#8959)

There is currently no way to separate whether UnicodeSyntax is accepted
for input from the corresponding output syntax using unicode symbols.
This patch implements a separate flag for affecting ghc(i)'s output.

Signed-off-by: Bertram Felgenhauer <>
Reviewed By: nomeata, austin

Differential Revision:

GHC Trac Issues: #8959

4 years agoApiAnnotations : lexer discards comment close in nested comment
Alan Zimmerman [Tue, 14 Apr 2015 12:32:52 +0000 (07:32 -0500)] 
ApiAnnotations : lexer discards comment close in nested comment

When parsing a nested comment, such as

  {-  nested comment  -}
  {-# nested pragma  #-}

The lexer returns the comment annotation as

  {-  nested comment
  {-# nested pragma  #

Restore the missing comment end markers in the annotation.

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #10277

4 years agoAPI Annotations : ExprWithTySig processing discards annotated spans
Alan Zimmerman [Tue, 14 Apr 2015 12:32:40 +0000 (07:32 -0500)] 
API Annotations : ExprWithTySig processing discards annotated spans

In RdrHsSyn.checkAPat the processing for ExprWithTySig is defined as

   ExprWithTySig e t _ -> do e <- checkLPat msg e
                             -- Pattern signatures are parsed as sigtypes,
                             -- but they aren't explicit forall points.  Hence
                             -- we have to remove the implicit forall here.
                             let t' = case t of
                                        L _ (HsForAllTy Implicit _ _
                                             (L _ []) ty) -> ty
                                        other -> other
                             return (SigPatIn e (mkHsWithBndrs t'))

The t' variable ends up losing its original SrcSpan in the first case
branch. This results in annotations becoming detached from the AST.

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #10255

4 years agoRemove LlvmCodeGen panic variants.
Edward Z. Yang [Tue, 14 Apr 2015 12:32:17 +0000 (07:32 -0500)] 
Remove LlvmCodeGen panic variants.

It's pretty irritating having hasktags with multiple top-level
declarations with the same type; hasktags can't figure out which
declaration you actually wanted.

Signed-off-by: Edward Z. Yang <>
Reviewed By: dterei, austin

Differential Revision:

4 years agoAdd "error:" prefix to error-messages
Konstantine Rybnikov [Tue, 14 Apr 2015 06:38:54 +0000 (01:38 -0500)] 
Add "error:" prefix to error-messages

Add "error:" prefix to error-messages, also lowercase "Warning:"
message to match GCC behavior closer.

Reviewed By: thomie, austin

Differential Revision:

GHC Trac Issues: #10021

4 years agoComments and white space only
Simon Peyton Jones [Tue, 14 Apr 2015 08:21:27 +0000 (09:21 +0100)] 
Comments and white space only

4 years agoComments only
Simon Peyton Jones [Tue, 14 Apr 2015 08:21:00 +0000 (09:21 +0100)] 
Comments only

4 years agoZap usage info in CSE (Trac #10218)
Simon Peyton Jones [Tue, 14 Apr 2015 08:20:42 +0000 (09:20 +0100)] 
Zap usage info in CSE (Trac #10218)

Trac #10218 reports a subtle bug that turned out to be:

- CSE invalidated the usage information computed
  by earlier demand analysis, by increasing sharing

- that made a single-entry thunk into a multi-entry thunk

- and with -feager-blackholing, that led to <<loop>>

The patch fixes it by making the CSE pass zap usage information for
let-bound identifiers.   It can be restored by -flate-dmd-anal.

(But making -flate-dmd-anal the default needs some careful work;
see Trac #7782.)

4 years agoparser : the API annotation on opt_sig is being discarded
Alan Zimmerman [Tue, 14 Apr 2015 06:17:58 +0000 (01:17 -0500)] 
parser : the API annotation on opt_sig is being discarded

The opt_sig production is defined as

  opt_sig :: { ([AddAnn],Maybe (LHsType RdrName)) }
          : {- empty -}                   { ([],Nothing) }
          | '::' sigtype                  { ([mj AnnDcolon $1],Just $2) }

It is used in the alt and decl_no_th productions, but neither of them
add the returned annotations.

This commit captures the annotations in the calling productions.

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #10254

4 years agoparser: API Annotations : guardquals1 does not annotate commas properly
Alan Zimmerman [Tue, 14 Apr 2015 06:17:48 +0000 (01:17 -0500)] 
parser: API Annotations : guardquals1 does not annotate commas properly

The `guardquals1` production includes

   : guardquals1 ',' qual  {% addAnnotation (gl $ last $ unLoc $1) AnnComma
                                             (gl $2) >>
                               return (sLL $1 $> ($3 : unLoc $1)) }

The AnnComma should be attached to `(gl $ head $ unLoc $1)`, rather than

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #10256

4 years agoparser: opt_kind_sig has incorrect SrcSpan
Alan Zimmerman [Tue, 14 Apr 2015 06:16:48 +0000 (01:16 -0500)] 
parser: opt_kind_sig has incorrect SrcSpan

The production for opt_kind_sig is

  opt_kind_sig :: { Located (Maybe (LHsKind RdrName)) }
          :                             { noLoc Nothing }
          | '::' kind                   {% ajl (sLL $1 $> (Just $2)) AnnDcolon (gl $1) }

The outer Location is used only to get the full span for the enclosing
declration, and is then stripped. The inner LHsKind then has a SrcSpan that does
not include the '::'

Extend the SrcSpan on $2 to include $1

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #10209

4 years agouse projectVersion from DynFlags rather than cProjectVersion for versionedAppDir
Luite Stegeman [Tue, 14 Apr 2015 06:13:27 +0000 (01:13 -0500)] 
use projectVersion from DynFlags rather than cProjectVersion for versionedAppDir

Reviewed By: edsko, austin

Differential Revision:

GHC Trac Issues: #10232

4 years agoDerive Generic instance for Data.Version.Version
Herbert Valerio Riedel [Tue, 14 Apr 2015 06:12:38 +0000 (01:12 -0500)] 
Derive Generic instance for Data.Version.Version

Reviewed By: austin

Differential Revision:

4 years agoDerive Generic instance for System.Exit.ExitCode
Herbert Valerio Riedel [Tue, 14 Apr 2015 06:12:22 +0000 (01:12 -0500)] 
Derive Generic instance for System.Exit.ExitCode

Reviewed By: austin

Differential Revision:

4 years agoFix autoconf's check for create_timer()
Austin Seipp [Tue, 14 Apr 2015 06:12:09 +0000 (01:12 -0500)] 
Fix autoconf's check for create_timer()

GHC build system have custom autoconf check for `create_timer()`
function from librt. Check description says that it checks for
`CLOCK_REALTIME` timer, but checking code also checks for
`CLOCK_PROCESS_CPUTIME_ID` timer, which is not commonly present (for
example, FreeBSD doesn't have it). This makes whole check fail despite
the fact that FreeBSD have `create_timer()` call and supports
`CLOCK_REALTIME`. As a consequence, GHC RTS falls back to using SIGALRM
for its timing machinery. Not only it's very ancient codepath, it also
break some FFI bindings to C code that isn't prepared for syscall
interruption caused by SIGALRM delivery.

Grepping through ghc source code reveals that `USE_TIMER_CREATE`
defininition in the config.h doesn't imply having
`CLOCK_PROCESS_CPUTIME_ID`. The only place where
`CLOCK_PROCESS_CPUTIME_ID` is used is rts/posix/GetTime.c and this code
handles the absence of `CLOCK_PROCESS_CPUTIME_ID` gracefully.

This patch makes autoconf checking code to check only for
`timer_create(CLOCK_REALTIME, ...)` and fixes check description.

Reviewed By: austin

Differential Revision:

4 years agoconfigure : LLVM and LD detections improvements (#10234).
Erik de Castro Lopo [Wed, 8 Apr 2015 05:11:38 +0000 (15:11 +1000)] 
configure : LLVM and LD detections improvements (#10234).

* distrib/ : Detect correct version of LLVM tools as
  was done for the top level in 42448e3757.
* aclocal.m4 : Add a FIND_LD macro that can be used in both
  configure scripts.
* Use new FIND_LD macro in both configure scripts.

Signed-off-by: Erik de Castro Lopo <>
Test Plan: validate on amd64-linux and armhf-linux.

Reviewers: rwbarton, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10234

4 years agoTypos in error messages and in comments
Gabor Greif [Fri, 10 Apr 2015 08:00:50 +0000 (10:00 +0200)] 
Typos in error messages and in comments

4 years agoMake the evidence in a CtGiven into an EvId
Simon Peyton Jones [Thu, 9 Apr 2015 16:36:41 +0000 (17:36 +0100)] 
Make the evidence in a CtGiven into an EvId

Note [Bind new Givens immediately] in TcRnTypes

We were never using the generality.  Result: less code, more efficient.
Cake for everyone.

4 years agoComments only
Simon Peyton Jones [Thu, 9 Apr 2015 14:03:05 +0000 (15:03 +0100)] 
Comments only

4 years agoComments in rejigConRes
Simon Peyton Jones [Thu, 9 Apr 2015 14:02:34 +0000 (15:02 +0100)] 
Comments in rejigConRes

4 years agoComments about AnyK
Simon Peyton Jones [Thu, 9 Apr 2015 14:02:08 +0000 (15:02 +0100)] 
Comments about AnyK

4 years agoImport rand using capi
Reid Barton [Thu, 9 Apr 2015 15:31:20 +0000 (11:31 -0400)] 
Import rand using capi

Summary: Android has no rand symbol (it's a static inline function there).

Test Plan: ghc-android builds

Reviewers: trofi, austin, hvr

Reviewed By: hvr

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10274

4 years agoFixes a compiler error with -DDEBUG (#10265)
Dave Laing [Wed, 8 Apr 2015 18:38:59 +0000 (14:38 -0400)] 
Fixes a compiler error with -DDEBUG (#10265)

Test Plan: validate

Reviewers: austin, ezyang, erikd, rwbarton

Reviewed By: ezyang, erikd, rwbarton

Subscribers: erikd, thomie

Differential Revision:

GHC Trac Issues: #10265

4 years agoTest Trac #8030
Simon Peyton Jones [Wed, 8 Apr 2015 08:43:20 +0000 (09:43 +0100)] 
Test Trac #8030

4 years agoIgnore temporary ./configure files.
Edward Z. Yang [Tue, 7 Apr 2015 20:44:51 +0000 (13:44 -0700)] 
Ignore temporary ./configure files.

Signed-off-by: Edward Z. Yang <>
4 years agoAxe one-shot sig-of
Edward Z. Yang [Tue, 2 Dec 2014 09:08:59 +0000 (01:08 -0800)] 
Axe one-shot sig-of

We're getting rid of -sig-of foo:A usage, because
it doesn't make sense in any compilation mode besides one-shot,
and we don't expect users to use it anyway.

Signed-off-by: Edward Z. Yang <>
Test Plan: validate

Reviewers: simonpj, austin

Subscribers: thomie

Differential Revision:

4 years agoCommit missing T10148 files and ignore the built executable.
Edward Z. Yang [Tue, 7 Apr 2015 18:59:09 +0000 (11:59 -0700)] 
Commit missing T10148 files and ignore the built executable.

Signed-off-by: Edward Z. Yang <>
4 years agoSupport for multiple signature files in scope.
Edward Z. Yang [Wed, 8 Oct 2014 03:54:54 +0000 (20:54 -0700)] 
Support for multiple signature files in scope.

A common pattern when programming with signatures is to combine multiple
signatures together (signature linking).  We achieve this by making it
not-an-error to have multiple, distinct interface files for the same module
name, as long as they have the same backing implementation.  When a user
imports a module name, they get ALL matching signatures dumped into their

On the way, I refactored the module finder code, which now distinguishes
between exact finds (when you had a 'Module') and regular finds (when
you had a 'ModuleName').  I also refactored the package finder code to
use a Monoid instance on LookupResult to collect together various results.

ToDo: At the moment, if a signature is declared in the local package,
it completely overrides any remote signatures.  Eventually, we'll want
to also pull in the remote signatures (or even override the local signature,
if the full implementation is available.)  There are bunch of ToDos in the
code for what to do once this is done.

ToDo: At the moment, whenever a module name lookup occurs in GHCi and we
would have seen a signature, we instead continue and return the Module
for the backing implementation.  This is correct for most cases, but there
might be some situations where we want something a little more fine-grained
(e.g. :browse should only list identifiers which are available through
the in-scope signatures, and not ALL of them.)

Signed-off-by: Edward Z. Yang <>
Test Plan: validate

Reviewers: simonpj, hvr, austin

Subscribers: carter, thomie

Differential Revision:

GHC Trac Issues: #9252

4 years agoFinal error message wibble
Simon Peyton Jones [Tue, 7 Apr 2015 16:52:14 +0000 (17:52 +0100)] 
Final error message wibble

4 years agoMore error message wibbles
Simon Peyton Jones [Tue, 7 Apr 2015 16:33:44 +0000 (17:33 +0100)] 
More error message wibbles

..due to suppressing base-package module names.

Needs a submodule update on array.

4 years agoTest Trac #10148
Simon Peyton Jones [Tue, 7 Apr 2015 16:20:43 +0000 (17:20 +0100)] 
Test Trac #10148

4 years agoThe production for squals is incorrect; see D806 for specifics.
Alan Zimmerman [Tue, 7 Apr 2015 14:10:27 +0000 (09:10 -0500)] 
The production for squals is incorrect; see D806 for specifics.

This diff depends on D803.

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #10214

4 years agoThe production for `pquals` is incorrect; the specifics are in D803.
Alan Zimmerman [Tue, 7 Apr 2015 14:10:18 +0000 (09:10 -0500)] 
The production for `pquals` is incorrect; the specifics are in D803.

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #10207

4 years agoDon't repeat package key with -dppr-debug when package info is missing.
Edward Z. Yang [Tue, 7 Apr 2015 14:08:54 +0000 (09:08 -0500)] 
Don't repeat package key with -dppr-debug when package info is missing.

Signed-off-by: Edward Z. Yang <>
Reviewed By: austin

Differential Revision:

4 years agorts/Linker.c: distinct between DATA and CODE labels when importing
Sergei Trofimovich [Tue, 7 Apr 2015 14:08:37 +0000 (09:08 -0500)] 
rts/Linker.c: distinct between DATA and CODE labels when importing

The patch is a last major piece to make unregisterised GHC build
under GCC's link-time optimizer.

Before the patch we imported everything external as functions.
Now we distinct between global variables and functions.

The difference is crucial on ia64 and a complement to fixes:
    > d82f592522eb8e063276a8a8c87ab93e18353c6b
    > CMM: add a mechanism to import C .data labels
    > e18525fae273f4c1ad8d6cbe1dea4fc074cac721
    > pprC: declare extern cmm primitives as functions, not data

Signed-off-by: Sergei Trofimovich <>
Reviewed By: austin

Differential Revision:

4 years agoReplace endian test by 64-bit word access in T7600
Peter Trommler [Tue, 7 Apr 2015 14:08:29 +0000 (09:08 -0500)] 
Replace endian test by 64-bit word access in T7600

In commit 3f30912f an include `ghcconfig.h` was added for

Converting the floating point array to a `Word64` array avoids
using the preprocessor altogether and leads to smaller code.

Fixes #10239

Reviewed By: rwbarton, austin

Differential Revision:

GHC Trac Issues: #10239

4 years agoLook inside synonyms for foralls when unifying
Simon Peyton Jones [Tue, 7 Apr 2015 13:45:04 +0000 (14:45 +0100)] 
Look inside synonyms for foralls when unifying

This fixes Trac #10194

4 years agoMore aggressive Given/Wanted overlap check
Simon Peyton Jones [Tue, 7 Apr 2015 13:29:10 +0000 (14:29 +0100)] 
More aggressive Given/Wanted overlap check

This fixes Trac #10195

For some reason we considered untouchability before, but Trac #10195
shows that this is positively worng.

See Note [Instance and Given overlap] in TcInteract.

Looking at the Git log, it seems that this bug was introduced at the
same time that we introduced the Given/Wanted overlap check in the first

4 years agoPut quotes round a Name in an error message
Simon Peyton Jones [Tue, 7 Apr 2015 13:06:11 +0000 (14:06 +0100)] 
Put quotes round a Name in an error message

Cosmetic consistency only

4 years agoDo not quantify over the function itself in a RULE
Simon Peyton Jones [Tue, 7 Apr 2015 13:01:39 +0000 (14:01 +0100)] 
Do not quantify over the function itself in a RULE

We were erroneously quantifying over the function when it
had a dictionary type. A bit pathological, but possible.

This fixes Trac #10251

4 years agoGHC.Prim.Constraint is not built-in syntax
Simon Peyton Jones [Tue, 7 Apr 2015 12:55:43 +0000 (13:55 +0100)] 
GHC.Prim.Constraint is not built-in syntax

This fixes Trac #10233

4 years agoError msg wibbles from reduced module prefixes
Simon Peyton Jones [Tue, 7 Apr 2015 13:54:56 +0000 (14:54 +0100)] 
Error msg wibbles from reduced module prefixes

4 years agoReduce module qualifiers in pretty-printing
Simon Peyton Jones [Tue, 7 Apr 2015 12:48:30 +0000 (13:48 +0100)] 
Reduce module qualifiers in pretty-printing

The change is in HscTypes.mkPrintUnqualified, and suppresses the
module qualifier on Names from ghc-prim, base, and template-haskell,
where no ambiguity can aries.  It's somewhat arbitrary, but helps
with things like 'Constraint' which are often not in scope, but
occasionally show up in error messages.

4 years agoFix a long-standing bug in the demand analyser
Simon Peyton Jones [Mon, 6 Apr 2015 13:10:52 +0000 (14:10 +0100)] 
Fix a long-standing bug in the demand analyser

This patch fixes Trac #10148, an outright and egregious
bug in the demand analyser.

It is explained in Note [Demand on case-alternative binders]
in Demand.hs.

I did some other minor refactoring.

To my astonishment I got some big compiler perf changes

* perf/compiler/T5837: bytes allocated -76%
* perf/compiler/T5030: bytes allocated -10%
* perf/compiler/T3294: max bytes used  -25%

Happy days

4 years agoSuggest how to fix .ghci when it is group writeable (#8248)
Vikas Menon [Tue, 7 Apr 2015 13:39:44 +0000 (15:39 +0200)] 
Suggest how to fix .ghci when it is group writeable (#8248)

chmod 664 $PATH_TO_GHCI_CONF/.ghci

Run ghci. You will now get a warning + a suggestion:

  *** WARNING: $PATH_TO_GHCI_CONF/.ghci is writable by someone else, IGNORING!
  Suggested fix: execute 'chmod 644 $PATH_TO_GHCI_CONF/.ghci'

Execute fix and the warning should disappear.

Reviewed By: mboes, thomie

Differential Revision:

4 years agotestdriver: delete unused ways
Thomas Miedema [Tue, 7 Apr 2015 09:50:11 +0000 (11:50 +0200)] 
testdriver: delete unused ways

And mention more prominently that `-DDEBUG` and tests that call
`compiler_stats_num_fields` don't play well together

Reviewed By: austin

Differential Revision:

4 years agoTypechecker: refactoring only
Thomas Miedema [Tue, 7 Apr 2015 09:48:35 +0000 (11:48 +0200)] 
Typechecker: refactoring only

* don't call `nlHsPar`, as `genOpApp` already does so.
* don't reimplement `isUnboxedTupleTyCon` and `isBoxedTupleTyCon`.

Reviewed By: austin

Differential Revision:

4 years agoAdd -n to the RTS help output
Simon Marlow [Thu, 26 Mar 2015 08:47:04 +0000 (08:47 +0000)] 
Add -n to the RTS help output

4 years agoAdd +RTS -O<size> to control the minimum old gen size
Simon Marlow [Tue, 24 Mar 2015 14:20:58 +0000 (14:20 +0000)] 
Add +RTS -O<size> to control the minimum old gen size

4 years agoReplace hooks by callbacks in RtsConfig (#8785)
Simon Marlow [Mon, 9 Jun 2014 08:18:12 +0000 (09:18 +0100)] 
Replace hooks by callbacks in RtsConfig (#8785)

Hooks rely on static linking semantics, and are broken by -Bsymbolic
which we need when using dynamic linking.

Test Plan: Built it

Reviewers: austin, hvr, tibbe

Differential Revision:

4 years agofix typo
Javran Cheng [Mon, 6 Apr 2015 11:36:21 +0000 (13:36 +0200)] 
fix typo

[skip ci]

Differential Revision:

4 years agofix '&stg_interp_constr_entry' FFI type to be FunPtr
Sergei Trofimovich [Mon, 6 Apr 2015 10:16:30 +0000 (11:16 +0100)] 
fix '&stg_interp_constr_entry' FFI type to be FunPtr

It used to be Ptr, which is slightly incorrect.
ia64 has different representations for those types.

Found when tried to build unregisterised ghc with -flto,
GCC's link-time optimisation which happens to check
data / code declaration inconsistencies.

It our case 'stg_interp_constr_entry' is an RTS function:
   StgFunPtr f (StgFunPtr)
while '"&f" :: Ptr()' produces
   StgWordArray f[];

Signed-off-by: Sergei Trofimovich <>
Reviewers: simonmar, hvr, austin

Reviewed By: austin

Subscribers: thomie

Differential Revision:

4 years agoStop profiling output from running together (#8811)
Dave Laing [Mon, 6 Apr 2015 10:10:29 +0000 (12:10 +0200)] 
Stop profiling output from running together (#8811)

Reviewed By: thomie

Differential Revision:

4 years agoUser's guide: .a files can be 2-2.5x larger with -split-objs
Thomas Miedema [Mon, 6 Apr 2015 09:51:34 +0000 (11:51 +0200)] 
User's guide: .a files can be 2-2.5x larger with -split-objs

And remove warning. This feature is available through cabal even.

Reviewed By: austin

Differential Revision:

4 years agoTest case for #10246
Joachim Breitner [Mon, 6 Apr 2015 07:37:42 +0000 (09:37 +0200)] 
Test case for #10246

still marked known_broken. This also adds the test case for #10245,
which should pass once #10246 is fixed.

4 years agoCmmSwitch: Do not trip over a case with no (valid) branches
Joachim Breitner [Sun, 5 Apr 2015 20:50:42 +0000 (22:50 +0200)] 
CmmSwitch: Do not trip over a case with no (valid) branches

This fixes #10245. I did not commit the test case, as it fails
unconditionally with a compiler built with -DDEBUG, so maybe it is bogus
Haskell anyways.

4 years agoUpdate hsc2hs submodule
Reid Barton [Sun, 5 Apr 2015 19:59:14 +0000 (15:59 -0400)] 
Update hsc2hs submodule

4 years agoWhitespace only
Reid Barton [Sun, 5 Apr 2015 19:33:35 +0000 (15:33 -0400)] 
Whitespace only

4 years agotestsuite: skip T10017 on Windows
Austin Seipp [Fri, 3 Apr 2015 11:33:26 +0000 (06:33 -0500)] 
testsuite: skip T10017 on Windows

Signed-off-by: Austin Seipp <>
4 years agorts/linker: make an error msg a debug msg
Austin Seipp [Fri, 3 Apr 2015 11:12:35 +0000 (06:12 -0500)] 
rts/linker: make an error msg a debug msg

This fixes more testsuite failures on Windows.

Signed-off-by: Austin Seipp <>
4 years agotestsuite: fix failing amd64/Windows perf tests
Austin Seipp [Fri, 3 Apr 2015 10:59:57 +0000 (05:59 -0500)] 
testsuite: fix failing amd64/Windows perf tests

Signed-off-by: Austin Seipp <>
4 years agoComments only, mostly typos
Thomas Miedema [Fri, 3 Apr 2015 15:58:53 +0000 (17:58 +0200)] 
Comments only, mostly typos

[skip ci]

4 years agoDon't `make accept` output of `expect_broken_for` tests
Thomas Miedema [Fri, 3 Apr 2015 12:01:15 +0000 (14:01 +0200)] 
Don't `make accept` output of `expect_broken_for` tests

This is a followup to d4cf7051bc17182238b17ba1dc42e190fa5c6f0d, which
did the same for `expect_broken` tests.

Reviewed By: austin

Differential Revision:

4 years agoRemove an incorrect statement about -fwarn-tabs
Dave Laing [Fri, 3 Apr 2015 05:49:38 +0000 (00:49 -0500)] 
Remove an incorrect statement about -fwarn-tabs

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #10213

4 years agoData.Complex: Derive Generic
Ben Gamari [Fri, 3 Apr 2015 05:48:51 +0000 (00:48 -0500)] 
Data.Complex: Derive Generic

Reviewed By: hvr, austin

Differential Revision:

4 years agoparser: allow type-level cons in prefix position
Kinokkory [Fri, 3 Apr 2015 05:47:15 +0000 (00:47 -0500)] 
parser: allow type-level cons in prefix position

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #10188

4 years agoRestore unwind information generation
Peter Wortmann [Fri, 3 Apr 2015 05:23:56 +0000 (00:23 -0500)] 
Restore unwind information generation

While we want to reduce the amount of information generated into
debug_info, it really doesn't make sense to remove block information
for unwinding.

This is a simple oversight introduced in 4ab57024, which severly
reduces the usefulness of generated unwind data. Thanks to bitonic
for spotting this!

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #10236

4 years agodocs: remove unused -ddump flags from users guide
Javran Cheng [Fri, 3 Apr 2015 05:24:06 +0000 (00:24 -0500)] 
docs: remove unused -ddump flags from users guide

According to

Reviewed By: austin

Differential Revision:

4 years agoclarify --no-as-needed is only needed on ELF
Peter Trommler [Fri, 3 Apr 2015 05:22:59 +0000 (00:22 -0500)] 
clarify --no-as-needed is only needed on ELF

From the code it was not clear that `--no-as-needed` was not necessary
on Windows. Add this fact and describe the fix for #10110 in a separate

See audit for rGHC1b7f59769052fd8193c6acc561216e070d0ca335 raised
by @thomie.

Reviewed By: thomie

Differential Revision:

GHC Trac Issues: #10110

4 years agoFix validate linenumber off-by-one
Thomas Miedema [Thu, 2 Apr 2015 22:19:15 +0000 (00:19 +0200)] 
Fix validate linenumber off-by-one