5 years agoAdd missing stack checks to stg_ap_* functions (#9001)
Simon Marlow [Wed, 14 May 2014 11:25:08 +0000 (12:25 +0100)] 
Add missing stack checks to stg_ap_* functions (#9001)

(cherry picked from commit fc0ed8a7309e7cc863b8155fae6b57cb23331c44)


5 years agoExtract derived constants from nm output for various OSes differently.
Christian Maeder [Thu, 3 Apr 2014 08:00:07 +0000 (10:00 +0200)] 
Extract derived constants from nm output for various OSes differently.

Fixes #8783.

In order to avoid querying the nm version that does not work on Mac OS X
we use the "nm -P" output that is supposed to produce (more portable)
POSIX output and works on all tested OSes (MinGW, Mac OS X, Solaris and
Linux using GNU nm) although slightly different (as documented). The "nm
-P" output is actually only needed to recognize the output of a non-GNU
Solaris nm (all other OSes produce sane outut using "nm" only).

Signed-off-by: Austin Seipp <>
5 years agorts: Fix memory leak when loading ELF objects
Austin Seipp [Tue, 29 Apr 2014 14:09:25 +0000 (09:09 -0500)] 
rts: Fix memory leak when loading ELF objects

Issue discovered by Coverity Scan, CID 43168.

Signed-off-by: Austin Seipp <>
(cherry picked from commit b7278d3d7bbe384eee7538b1e50bb741e99fb01d)

5 years agorts: Fix leak of file archive handle
Austin Seipp [Tue, 29 Apr 2014 14:05:38 +0000 (09:05 -0500)] 
rts: Fix leak of file archive handle

Issue discovered by Coverity Scan, CID 43171.

Signed-off-by: Austin Seipp <>
(cherry picked from commit e597f5feb065c075c86715e24bf0ebd341fa8b9e)

5 years agoAdd a comprehensive test for using Annotations from TH
Gergely Risko [Fri, 25 Apr 2014 13:39:26 +0000 (15:39 +0200)] 
Add a comprehensive test for using Annotations from TH

The provided tests test both annotation generation and reification
from Template Haskell.  Both --make and compilation via separate
units (ghc -c) are tested.

Signed-off-by: Austin Seipp <>
(cherry picked from commit 5f5e326c3c310c4bceb2b0bce291d3a0a3fc30d6)

5 years agoFix annotation reification for home package modules
Gergely Risko [Fri, 25 Apr 2014 13:35:58 +0000 (15:35 +0200)] 
Fix annotation reification for home package modules

The reifyAnnotation method of the Q monad correctly gathered annotations
from TCG and EPS.  Unfortunately it didn't look into the Home Package
Table.  This resulted in annotations not being found if they are in the
same package as the splice that is reifying and ghc --make is used for
compilation management.  Fix this by using the already existing
prepareAnnotations method from HscTypes.lhs that correctly searches
in HPT and EPS both.

Signed-off-by: Austin Seipp <>
(cherry picked from commit 48e475e45f517896c6618d38a09b8d223f3d7585)

5 years agoTest Trac #8963
Simon Peyton Jones [Tue, 8 Apr 2014 15:28:56 +0000 (16:28 +0100)] 
Test Trac #8963

(cherry picked from commit cc3ccf9f47c7f4684cdd2b08d0e2acf50b69bc18)


5 years agoAllow a longer demand signature than arity
Simon Peyton Jones [Tue, 8 Apr 2014 15:20:11 +0000 (16:20 +0100)] 
Allow a longer demand signature than arity

See Note [Demand analysis for trivial right-hand sides] in DmdAnal.
This allows a function with arity 2 to have a DmdSig with 3 args;
which in turn had a knock-on effect, which showed up in the test for
Trac #8963.

In fact it seems entirely reasonable, so this patch removes the
WARN and CoreLint checks that were complaining.

(cherry picked from commit 848f595266268f578480ceb4ab1ce4938611c97e)

5 years agoFix scavenge_stack crash (#9045)
Simon Marlow [Mon, 28 Apr 2014 15:36:29 +0000 (16:36 +0100)] 
Fix scavenge_stack crash (#9045)

The new stg_gc_prim_p_ll stack frame was missing an info table.  This
is a regression since 7.6, because this stuff was part of a cleanup
that happened in 7.7.

(cherry picked from commit ab8bb4893be1896303f30d0f1adff8ea9c2470f6)

5 years agoMention TH pattern splices in 7.8.1 release notes
Christiaan Baaij [Mon, 28 Apr 2014 10:13:11 +0000 (12:13 +0200)] 
Mention TH pattern splices in 7.8.1 release notes

5 years agoStart 7.8.3 release notes
Austin Seipp [Mon, 28 Apr 2014 09:33:07 +0000 (04:33 -0500)] 
Start 7.8.3 release notes

There are already quite a few bugfixes, I'll fill them out shortly.

Signed-off-by: Austin Seipp <>
5 years agoFix memleak in hp2ps
Nicolas Trangez [Wed, 23 Apr 2014 19:14:23 +0000 (21:14 +0200)] 
Fix memleak in hp2ps

Issue discovered by Coverity scan, CID 43167.

Signed-off-by: Austin Seipp <>
(cherry picked from commit f17dcf09a5797bbefe22aef7d4c508d1672484df)

5 years agoCheck correct variable for NULL
Nicolas Trangez [Wed, 23 Apr 2014 18:37:51 +0000 (20:37 +0200)] 
Check correct variable for NULL

Issue discovered by Coverity scan, CID 43163. This should fix CID 43172 as a
side-effect as well.

Signed-off-by: Austin Seipp <>
(cherry picked from commit 6ed7123dcc24c343a1ece85c7aa72ac1c34e6aff)

5 years agoFix potential out-of-bound memory access
Nicolas Trangez [Wed, 23 Apr 2014 18:27:04 +0000 (20:27 +0200)] 
Fix potential out-of-bound memory access

Issue discovered by Coverity scan, CID 43165.

Signed-off-by: Austin Seipp <>
(cherry picked from commit fa0cbd297ba12e02273efcaa5f52fe76e10b7126)

5 years agoCheck return value of sigaction
Nicolas Trangez [Wed, 23 Apr 2014 18:06:15 +0000 (20:06 +0200)] 
Check return value of sigaction

Issue discovered by Coverity scan, CID 43142.

Signed-off-by: Austin Seipp <>
(cherry picked from commit f2595fd9d03803874df792072292d792a2c03bce)

5 years agorts: Fix possible int overflow in resize_nursery
Austin Seipp [Wed, 23 Apr 2014 08:41:44 +0000 (03:41 -0500)] 
rts: Fix possible int overflow in resize_nursery

n_capabilities is declared as unsigned int (32bit), and so multiplication
is 32-bit before being stored in a 64bit integer (StgWord).

Instead, cast n_capabilities to StgWord before multiplying.

Discovered by Coverity. CID 43164.

Signed-off-by: Austin Seipp <>
(cherry picked from commit 111b8454cc1b64da5b9816b89d79f44a8ae24355)

5 years agorts: Fix potential memory leak in ProfHeap.c
Austin Seipp [Wed, 23 Apr 2014 07:14:15 +0000 (02:14 -0500)] 
rts: Fix potential memory leak in ProfHeap.c

Discovered by Coverity. CID 43166.

Signed-off-by: Austin Seipp <>
(cherry picked from commit 95da409719bab6f92229dc1a632c471e248d2fdd)

5 years agoTest Trac #8985
Simon Peyton Jones [Mon, 14 Apr 2014 12:06:22 +0000 (13:06 +0100)] 
Test Trac #8985

(cherry picked from commit ff9f9a7f2e227fcda7b8a2f52ec8be66de2e76cd)

5 years agoHonour the untouchability of kind variables
Simon Peyton Jones [Mon, 14 Apr 2014 12:03:40 +0000 (13:03 +0100)] 
Honour the untouchability of kind variables

Trac #8985 showed up a major shortcoming in the kind unifier: it was
ignoring untoucability.  This has unpredictably-bad consequences;
notably, the skolem-escape check can fail.

There were two things wrong
 * TcRnMonad.isTouchableTcM was returning a constant value for kind variables
   (wrong), and even worse the constant was back-to-front (it was always False).

 * We weren't even calling isTouchableTcM in TcType.unifyKindX.

I'm not sure how this ever worked.

Merge to 7.8.3 in due course.

(cherry picked from commit e7f0ae7ff4f2199abe42f20bac825a7802bff466)

5 years agoSimplify and tidy up the handling of tuple names
Simon Peyton Jones [Fri, 4 Apr 2014 07:41:35 +0000 (08:41 +0100)] 
Simplify and tidy up the handling of tuple names

This fixes Trac #8954.

There were actually three places where tuple occ-names
were parsed:
  - IfaceEnv.lookupOrigNameCache
  - Convert.isBuiltInOcc
  - OccName.isTupleOcc_maybe

I combined all three into TysWiredIn.isBuiltInOcc_maybe
Much nicer.

(cherry picked from commit 750271e61bdbaad50c19176406512e79abe404a8)


5 years agoZonk the existential type variables in tcPatSynDecl
Simon Peyton Jones [Tue, 8 Apr 2014 08:42:51 +0000 (09:42 +0100)] 
Zonk the existential type variables in tcPatSynDecl

This was just an omission, which showed up as Trac #8966

(cherry picked from commit 4dc9f9869bfc82fdb8bd61864859007873ebcc27)

5 years agoKill whitespace after cpp's `-I` flag
Herbert Valerio Riedel [Mon, 21 Apr 2014 14:55:11 +0000 (16:55 +0200)] 
Kill whitespace after cpp's `-I` flag

This clean-up is in a similiar spirit as 574ef4293b8676.

Signed-off-by: Herbert Valerio Riedel <>
(cherry picked from commit 4ab8fc55eb6119dbba2f487c5a01d30a7c6ae113)

5 years agoghc: Do not add a space in '-U __PIC__'
Austin Seipp [Mon, 21 Apr 2014 12:22:50 +0000 (07:22 -0500)] 
ghc: Do not add a space in '-U __PIC__'

GHC previously introduced a space here. However, this can in some cases
be interpreted as "-U __PIC__" - note that in shell, the -U would still
be recognized with an argument, but the argument would be " __PIC__",
with a space in front, as opposed to the single string '__PIC__'.

In practice most tools seem to handle this OK. But the Coverity Scan
analysis tool does not: it errors on the fact that ' __PIC__' is an
invalid CPP name to undefine.

With this, it seems the Coverity analysis tool can easily analyze the
entire GHC build.

Signed-off-by: Austin Seipp <>
(cherry picked from commit 574ef4293b867609f2d28d85747e01f3ac0d052d)

5 years agoAdd the powerpc64le architecture
Colin Watson [Sat, 12 Apr 2014 01:13:48 +0000 (02:13 +0100)] 
Add the powerpc64le architecture

This is ArchUnknown for now, as it requires some porting work over and
above powerpc64 due to such things as the different function calling
sequence in the ELFv2 ABI.  For now, an unregisterised port is better
than nothing.

Signed-off-by: Colin Watson <>
Signed-off-by: Austin Seipp <>
(cherry picked from commit 8586f600613a6a99fee8fe707b00adab1a340641)

5 years agoBe less untruthful about the prototypes of external functions
Colin Watson [Sat, 12 Apr 2014 00:55:07 +0000 (01:55 +0100)] 
Be less untruthful about the prototypes of external functions

GHC's generated C code uses dummy prototypes for foreign imports.  At the
moment these all claim to be (void), i.e. functions of zero arguments.  On
most platforms this doesn't matter very much: calls to these functions put
the parameters in the usual places anyway, and (with the exception of
varargs) things just work.

However, the ELFv2 ABI on ppc64 optimises stack allocation
( a call to a
function that has a prototype, is not varargs, and receives all parameters
in registers rather than on the stack does not require the caller to
allocate an argument save area.  The incorrect prototypes cause GCC to
believe that all functions declared this way can be called without an
argument save area, but if the callee has sufficiently many arguments then
it will expect that area to be present, and will thus corrupt the caller's
stack.  This happens in particular with calls to runInteractiveProcess in

The simplest fix appears to be to declare these external functions with an
unspecified argument list rather than a void argument list.  This is no
worse for platforms that don't care either way, and allows a successful
bootstrap of GHC 7.8 on little-endian Linux ppc64 (which uses the ELFv2

Fixes #8965

Signed-off-by: Colin Watson <>
Signed-off-by: Austin Seipp <>
(cherry picked from commit 5a31f231eebfb8140f9b519b166094d9d4fc2d79)

5 years agoSmall issue with signatures in a TH splice (fixes Trac #8932)
Simon Peyton Jones [Mon, 7 Apr 2014 14:22:11 +0000 (15:22 +0100)] 
Small issue with signatures in a TH splice (fixes Trac #8932)

(cherry picked from commit d8d798b1b33ab0593ed03f193360b8725ba2c2ba)


5 years agoFix #8641, creating directories when we have stubs.
Edward Z. Yang [Fri, 11 Apr 2014 01:28:11 +0000 (18:28 -0700)] 
Fix #8641, creating directories when we have stubs.

Signed-off-by: Edward Z. Yang <>
(cherry picked from commit c7498bbdaa74dadd976c75c4e303c2050aa78277)

5 years agoDon't preprocess .s files
Simon Marlow [Tue, 8 Apr 2014 09:21:27 +0000 (10:21 +0100)] 
Don't preprocess .s files

One important reason is that gcc 4.8.1 sometimes crashes:

Another reason is that preprocessing assembly files unnecessarily
slows down compilation.

(cherry picked from commit 396648eebaa1144d4d1f5326db716e8130f73732)

5 years agoInclude LD_OPTS when building the RTS shared libs
Simon Marlow [Mon, 7 Apr 2014 12:51:29 +0000 (13:51 +0100)] 
Include LD_OPTS when building the RTS shared libs

(cherry picked from commit ec3e949e29990c054850f621e14a9d77e3197aee)

5 years agoRemove debugging output
Simon Marlow [Fri, 28 Mar 2014 09:09:38 +0000 (09:09 +0000)] 
Remove debugging output

(cherry picked from commit 4c8edfd2c722504baaa6896d194fd3a8c3f9b652)

5 years agoUse LDFLAGS when compiling ghc-pwd
Simon Marlow [Thu, 27 Mar 2014 12:34:38 +0000 (12:34 +0000)] 
Use LDFLAGS when compiling ghc-pwd

(cherry picked from commit 2aa78106ae8f3c9b71d7b85c2a8a5558c4c35fb4)

5 years agoInclude SRC_CC_OPTS and SRC_LD_OPTS when compiling ghc-cabal
Simon Marlow [Thu, 27 Mar 2014 12:33:44 +0000 (12:33 +0000)] 
Include SRC_CC_OPTS and SRC_LD_OPTS when compiling ghc-cabal

(cherry picked from commit d011cdefca7aa66cbcf71c941f38a4e6dd4c5579)

5 years agoPass custom CC and LD opts to Cabal when configuring a package
Simon Marlow [Thu, 27 Mar 2014 12:29:48 +0000 (12:29 +0000)] 
Pass custom CC and LD opts to Cabal when configuring a package

Cabal compiles a program to check for the existence of foreign
libraries, so it needs to know our custom options, if any.

(cherry picked from commit e7f26cd3e7e9eb92e3eb3457730e635747b43050)

5 years agoInclude EXTRA_LD_OPTS (amongst other things) when linking programs
Simon Marlow [Tue, 25 Mar 2014 14:32:28 +0000 (14:32 +0000)] 
Include EXTRA_LD_OPTS (amongst other things) when linking programs

One problem was that we weren't including $1_$2_DIST_LD_OPTS when
linking a program, which looks to be accidental: it was being defined
but not used anywhere.  This meant that setting $1_$2_EXTRA_LD_OPTS,
for example, had no effect.

This commit straightens out the handling of LD_OPTS to be consistent
with the way we handle CC_OPTS and HC_OPTS.

(cherry picked from commit 975e9cb8e7744a0750bb6c8763f628e05672643e)

5 years agoDon't perform permission checks for scripts named with -ghci-script (#6017)
Simon Marlow [Thu, 20 Mar 2014 21:47:22 +0000 (21:47 +0000)] 
Don't perform permission checks for scripts named with -ghci-script (#6017)

The user explicitly requested this script on the command-line, so it's
unnecessary to require that the script is also owned by the user.
Also, it is currently impossible to make a GHCi wrapper that invokes a
custom script without first making a copy of the script to circumvent
the permissions check, which seems wrong.

(cherry picked from commit a6f2c852d49313fa8acea2deb3741ab86c6ef995)

5 years ago--with-gcc overrides CC_STAGE0 when not cross-compiling (#8498)
Simon Marlow [Thu, 20 Mar 2014 15:47:18 +0000 (15:47 +0000)] 
--with-gcc overrides CC_STAGE0 when not cross-compiling (#8498)

(cherry picked from commit 6189c7674fc5c735db1a446d0b222369a3767369)

5 years agoFix linked list manipulation code (buggy on consecutive deletion)
Edward Z. Yang [Sun, 13 Apr 2014 06:02:13 +0000 (23:02 -0700)] 
Fix linked list manipulation code (buggy on consecutive deletion)

Signed-off-by: Edward Z. Yang <>
(cherry picked from commit e3938f3adac0093b23694fd347774244ce121478)

5 years agoSet RELEASE=NO
Austin Seipp [Mon, 14 Apr 2014 12:36:31 +0000 (07:36 -0500)] 

Signed-off-by: Austin Seipp <>
5 years agoSet VERSION=7.8.2, RELEASE=YES ghc-7.8.2-release
Austin Seipp [Thu, 10 Apr 2014 13:42:49 +0000 (08:42 -0500)] 

Signed-off-by: Austin Seipp <>
5 years agoUpdate ANNOUNCE for GHC 7.8.2
Austin Seipp [Thu, 10 Apr 2014 13:37:58 +0000 (08:37 -0500)] 
Update ANNOUNCE for GHC 7.8.2

Signed-off-by: Austin Seipp <>
5 years agousers_guide: Update relnotes for 7.8.2
Austin Seipp [Thu, 10 Apr 2014 13:37:48 +0000 (08:37 -0500)] 
users_guide: Update relnotes for 7.8.2

Signed-off-by: Austin Seipp <>
5 years agoFix egregious blunder in the type flattener
Simon Peyton Jones [Wed, 9 Apr 2014 21:47:09 +0000 (22:47 +0100)] 
Fix egregious blunder in the type flattener

In tidying up the flattener I introduced an error that no
regression test caught, giving rise to Trac #8978, #8979.
It shows up if you have a type synonym whose RHS mentions
type functions, such sas
     type family F a
     type T a = (F a, a)   -- This synonym isn't properly flattened

The fix is easy, but sadly the bug is in the released GHC 7.8.1

(cherry picked from commit b8132a9d2fdb93c5d30107b1d531dd73ac27b262)

5 years agoSet RELEASE=NO
Austin Seipp [Thu, 10 Apr 2014 12:39:09 +0000 (07:39 -0500)] 

Signed-off-by: Austin Seipp <>
5 years agoSet VERSION=7.8.1, RELEASE=YES ghc-7.8.1-release
Austin Seipp [Mon, 7 Apr 2014 21:26:42 +0000 (16:26 -0500)] 

Signed-off-by: Austin Seipp <>
5 years agoUpdate ANNOUNCE for GHC 7.8.1
Austin Seipp [Mon, 7 Apr 2014 21:25:50 +0000 (16:25 -0500)] 
Update ANNOUNCE for GHC 7.8.1

Signed-off-by: Austin Seipp <>
5 years agousers_guide: note -XPatternSynonyms is required for use sites
Austin Seipp [Mon, 7 Apr 2014 15:15:05 +0000 (10:15 -0500)] 
users_guide: note -XPatternSynonyms is required for use sites

Signed-off-by: Austin Seipp <>
(cherry picked from commit b059dcc81e9c4097b5f04f85e1ac33586c494110)

5 years agoT8958: fix stderr
Austin Seipp [Mon, 7 Apr 2014 14:05:29 +0000 (09:05 -0500)] 
T8958: fix stderr

Signed-off-by: Austin Seipp <>
5 years agoRequire PatternSynonyms language flag when encountering a use of pattern synonym
Dr. ERDI Gergo [Sun, 6 Apr 2014 13:26:46 +0000 (21:26 +0800)] 
Require PatternSynonyms language flag when encountering a use of pattern synonym

(cherry picked from commit 8f831ec578d22419788542290e164c50524d90f6)

5 years agoRevert "Revert ad15c2, which causes Windows seg-faults (Trac #8834)"
Austin Seipp [Fri, 4 Apr 2014 15:33:03 +0000 (10:33 -0500)] 
Revert "Revert ad15c2, which causes Windows seg-faults (Trac #8834)"

This reverts commit a79613a75c7da0d3d225850382f0f578a07113b5.

(cherry picked from commit c6c86789c95462216a3167d7b98b202a5bf4c0b2)

5 years agoFix desguaring of bang patterns (Trac #8952)
Simon Peyton Jones [Thu, 3 Apr 2014 12:30:59 +0000 (13:30 +0100)] 
Fix desguaring of bang patterns (Trac #8952)

A palpable bug, although one that will rarely bite

(cherry picked from commit 3671d0027329804a31a628a5bee355e0640a2045)

5 years agoFix copy/paste error (#8937)
Simon Marlow [Tue, 1 Apr 2014 12:02:59 +0000 (13:02 +0100)] 
Fix copy/paste error (#8937)

(cherry picked from commit 59b9b067b030d551f9b42423b50770c661c9d86c)

5 years agoTest Trac #8931
Simon Peyton Jones [Thu, 3 Apr 2014 12:34:52 +0000 (13:34 +0100)] 
Test Trac #8931

(cherry picked from commit 8bf8ce1e7cb1b97a1f18ec6f5552e339808ffba9)

5 years agoMake sure that polykinded Typeable is defaultable (Trac #8931)
Simon Peyton Jones [Tue, 1 Apr 2014 13:34:11 +0000 (14:34 +0100)] 
Make sure that polykinded Typeable is defaultable (Trac #8931)

(cherry picked from commit 791f4fa24dd6929ab2e55c9f8b870d8078337427)

5 years agowindows: Fix #8870
Austin Seipp [Fri, 4 Apr 2014 15:33:14 +0000 (10:33 -0500)] 
windows: Fix #8870

This bumps the amount of default reserved and committed stack for GHC
executables to 8mb, to work around #8870. A proper fix should happen in

See note [Windows stack usage] in SysTools for the details.

Signed-off-by: Austin Seipp <>
(cherry picked from commit f0af58df4b5d5ace750e7d7a91ad471284c1b429)

5 years agoFix #8958.
Richard Eisenberg [Sat, 5 Apr 2014 17:56:00 +0000 (13:56 -0400)] 
Fix #8958.

We now do role inference on stupid datatype contexts, allowing a
lightweight role annotation syntax.

(cherry picked from commit d468cd376ffc02cf9f4755275a316be914c482be)

5 years agoBump haddock.base test-case resource limits due to haddock-2.14.2
Herbert Valerio Riedel [Tue, 1 Apr 2014 20:36:02 +0000 (22:36 +0200)] 
Bump haddock.base test-case resource limits due to haddock-2.14.2

Signed-off-by: Herbert Valerio Riedel <>
5 years agoTemporarily fight off build bogons on OS X
Austin Seipp [Mon, 31 Mar 2014 11:47:44 +0000 (06:47 -0500)] 
Temporarily fight off build bogons on OS X

Right now there's a bug with Clang that prevents 'cabal haddock' from
working nicely. But there's an easy fix for now.

Signed-off-by: Austin Seipp <>
(cherry picked from commit 52c6dc970272437aa83a936fc1fe63977fa6178d)

5 years agorts: remove unused functions, fix validate on OS X
Austin Seipp [Thu, 27 Mar 2014 21:51:07 +0000 (16:51 -0500)] 
rts: remove unused functions, fix validate on OS X

After a toolchain update, Clang is no longer appreciative of the fact
these are unused, thanks to -Werror during validate.

Signed-off-by: Austin Seipp <>
(cherry picked from commit 7ef3f0d6dbd54d9e58fb6ab1f2db322bc8fac37a)

5 years agoUse the correct callClobberedRegs on Windows/x64 (#8834)
Simon Marlow [Mon, 24 Mar 2014 14:36:16 +0000 (14:36 +0000)] 
Use the correct callClobberedRegs on Windows/x64 (#8834)

Signed-off-by: Austin Seipp <>
(cherry picked from commit c4eeacdfdf4578eb6e75bbf2e067bfe70ec94ab0)

5 years agoImplement ordering comparisons for type-level naturals and symbols.
Iavor S. Diatchki [Wed, 19 Mar 2014 01:54:23 +0000 (18:54 -0700)] 
Implement ordering comparisons for type-level naturals and symbols.

This is done with two built-in type families: `CmpNat and `CmpSymbol`.
Both of these return a promoted `Ordering` type (EQ, LT, or GT).

(cherry picked from commit 5e4bdb5fc5e741522cbb787731422da3f12aa398)

5 years agoFlattener preserves synonyms, rewriteEvidence can drop buggy "optimisation"
Simon Peyton Jones [Fri, 21 Mar 2014 15:37:27 +0000 (15:37 +0000)] 
Flattener preserves synonyms, rewriteEvidence can drop buggy "optimisation"

There was a special case in rewriteEvidence, looking like:
  = return (Just (if ctEvPred old_ev `tcEqType` new_pred
                  then old_ev
                  else old_ev { ctev_pred = new_pred }))

But this was wrong: old_pred and new_pred might differ in the kind
of a TyVar occurrence, in which case tcEqType would not notice,
but we really, really want new_pred.  This caused Trac #8913.

I solved this by dropping the whole test, and instead making
the flattener preserve type synonyms. This was easy because
TcEvidence has TcTyConAppCo which (unlike) Coercion, handles

(cherry picked from commit 6ae678e31a5fdd3b0bd1f8613fe164012bb630f4)

5 years agoFor equalities with incompatible kinds, new IrredCan goes in the inert set, not work...
Simon Peyton Jones [Fri, 21 Mar 2014 15:32:58 +0000 (15:32 +0000)] 
For equalities with incompatible kinds, new IrredCan goes in the inert set, not work list

This change makes the code for canIrred markedly simpler (and more efficient)
See Note [Equalities with incompatible kinds].

I don't think there was really a bug here, but I came across it when
fixing Trac #8913

(cherry picked from commit c89c57e3b72a8f3de9f35e1bd6e0f70d2b18a941)

5 years agoImplicit parameters should not be allowed in class and instance declarations
Simon Peyton Jones [Fri, 21 Mar 2014 15:55:39 +0000 (15:55 +0000)] 
Implicit parameters should not be allowed in class and instance declarations

Trac #8912 pointed out that GHC 7.4 and 7.6 have omitted this test, although
7.2 and earlier had it.  This patch puts the test back in, and refactors a

(cherry picked from commit a8b7b28cdb98d14c6fb43d5ad3293fd4a5c1f8b4)


5 years agorelnotes: GND is not -XSafe compatible.
Austin Seipp [Mon, 24 Mar 2014 11:07:27 +0000 (06:07 -0500)] 
relnotes: GND is not -XSafe compatible.

Signed-off-by: Austin Seipp <>
(cherry picked from commit 73cab206e0f211b75cb6fd62ab9b6ca8ae0950f2)

5 years agoAdd missing kind-check for tcEqType on forall-types
Simon Peyton Jones [Fri, 21 Mar 2014 15:24:49 +0000 (15:24 +0000)] 
Add missing kind-check for tcEqType on forall-types

This wasn't showing up as a bug, but it was definitely wrong.

(cherry picked from commit 74894e0bc405247092e865b9541f5f18d26aa015)

5 years agoRevert "change deriveConstants to use nm in a POSIX way (fixes #8781)"
Austin Seipp [Mon, 24 Mar 2014 07:14:09 +0000 (02:14 -0500)] 
Revert "change deriveConstants to use nm in a POSIX way (fixes #8781)"

It causes a failure on Windows right now.

This reverts commit 045b28033a33a48d31951240a8cb35f2b78345dc.

(cherry picked from commit 15b1eb7c67e29c4ad6f6859f89d220b33493fd46)

5 years agoEnable popcnt test now when segfault is fixed
Johan Tibell [Sat, 22 Mar 2014 17:30:36 +0000 (18:30 +0100)] 
Enable popcnt test now when segfault is fixed

The fix was to ghc-prim.

(cherry picked from commit 16d04d902d4720b3137e07a503fbf72c90b9e164)

5 years agoFollow hs_popcntX changes in ghc-prim
Johan Tibell [Sat, 22 Mar 2014 17:29:29 +0000 (18:29 +0100)] 
Follow hs_popcntX changes in ghc-prim

(cherry picked from commit 1a63f17f19a6c83980efe453966eac1cf441b277)

5 years agoRevert "Fix #8745 - GND is now -XSafe compatible."
Austin Seipp [Mon, 24 Mar 2014 04:45:22 +0000 (23:45 -0500)] 
Revert "Fix #8745 - GND is now -XSafe compatible."

See #8827 - for now, we're making GND unsafe again.

This also fixes the tests since they were originally not using the new
unicode quote style we're using.

This reverts commit a8a01e742434df11b830ab99af12d9045dfcbc4b.

(cherry picked from commit 8f7303774237a8b0787d98c5ab6f605e3e897f19)

5 years agoTest Trac #8893
Simon Peyton Jones [Sun, 23 Mar 2014 18:44:43 +0000 (18:44 +0000)] 
Test Trac #8893

(cherry picked from commit 7973bfb87fdbe6e980e64ed5d7b2a90a469effd4)

5 years agoApply the kind subst to the (kinds of the) quanitifed tyvars in deriveTyData
Simon Peyton Jones [Sat, 22 Mar 2014 23:11:10 +0000 (23:11 +0000)] 
Apply the kind subst to the (kinds of the) quanitifed tyvars in deriveTyData

I've elaboated Note [Unify kinds in deriving] to explain
what is going on here.

The change fixes Trac #8893.

(cherry picked from commit ffed708c30f2d1d4b4c5cd08d9c19aeb0bb623ec)

5 years agoMake sure we occurrence-analyse unfoldings (fixes Trac #8892)
Simon Peyton Jones [Tue, 18 Mar 2014 17:10:18 +0000 (17:10 +0000)] 
Make sure we occurrence-analyse unfoldings (fixes Trac #8892)

For DFunUnfoldings we were failing to occurrence-analyse the unfolding,
and that meant that a loop breaker wasn't marked as such, which in turn
meant it was inlined away when it still had occurrence sites.  See
Note [Occurrrence analysis of unfoldings] in CoreUnfold.

This is a pretty long-standing bug, happily nailed by John Lato.

(cherry picked from commit 87bbc69c40d36046492d754c8d7ff02c3be6ce43)

5 years agoTest Trac #8889
Simon Peyton Jones [Mon, 17 Mar 2014 13:50:54 +0000 (13:50 +0000)] 
Test Trac #8889

(cherry picked from commit 0e2155ddb10f4ccf53e50064756cbc3ce7dd8832)

5 years agoUnflatten the constraints of an inferred types (Trac #8889)
Simon Peyton Jones [Fri, 14 Mar 2014 22:51:20 +0000 (22:51 +0000)] 
Unflatten the constraints of an inferred types (Trac #8889)

There was even a comment to warn about this possiblity,
and it finally showed up in practice!  This patch fixes
it quite nicely, with commens to explain.

(cherry picked from commit 7a7af1ffc48f605cf365faf8fcef31ef4f13822b)

5 years agoTest Trac #8856
Simon Peyton Jones [Fri, 7 Mar 2014 17:15:15 +0000 (17:15 +0000)] 
Test Trac #8856

(cherry picked from commit 062391be4f06aa408187582c4a40f1cea80429c3)

5 years agoFix the treatment of lexically scoped kind variables (Trac #8856)
Simon Peyton Jones [Fri, 7 Mar 2014 16:50:17 +0000 (16:50 +0000)] 
Fix the treatment of lexically scoped kind variables (Trac #8856)

The issue here is described in Note [Binding scoped type variables] in
TcPat.  When implementing this fix I was able to make things quite a
bit simpler:
 * The type variables in a type signature now never unify
   with each other, and so can be straightfoward skolems.
 * We only need the SigTv stuff for signatures in patterns,
   and for kind variables.

(cherry picked from commit cf1a0f971966af633fbd932ad012ce716680465b)

5 years agoTrac #8831 is fixed
Simon Peyton Jones [Sun, 23 Mar 2014 18:46:22 +0000 (18:46 +0000)] 
Trac #8831 is fixed

(cherry picked from commit 1a7709ef9b25175566bc040a34b3d479ea8566ed)


5 years agoSimplify handling of the interactive package; fixes Trac #8831
Simon Peyton Jones [Sat, 22 Mar 2014 23:18:14 +0000 (23:18 +0000)] 
Simplify handling of the interactive package; fixes Trac #8831

This patch is really a fix to the big commint
   Re-work the naming story for the GHCi prompt (Trac #8649)
which introduced the 'interactive' package
See Note [The interactive package] in HscTypes

The original commit set both
  (a) The tcg_mod field of TcGblEnv to 'interactive:Ghci4' (say)
  (b) The thisPackage field of DynFlags to 'interactive'

But the second step interacts badly with linking.  :loaded modules are
in the package set by 'thisPackage' (usually 'main'); if you change
that, then we try to link package 'main', but can't find it, and
that is what happened in #8831.

The fix was simple: do (a) but not (b).

I changed Note [The interactive package] in HscTypes to describe this.

(cherry picked from commit 28e8d878b63d06824001ac3a631254679e0f1960)

5 years agoAlso allow (#8824)
Joachim Breitner [Sat, 8 Mar 2014 00:11:42 +0000 (01:11 +0100)] 
Also allow (#8824)

(cherry picked from commit d246c62afd7312185aee9433b065ea99e4fa4054)

5 years agoMake sync-all handle all github protocols correctly
Joachim Breitner [Fri, 7 Mar 2014 15:50:43 +0000 (16:50 +0100)] 
Make sync-all handle all github protocols correctly

This fixes #8824.

(cherry picked from commit 3efcb0a7d147e05f86501783144bcd0ad3757e93)

5 years agoCorrectly clone submodules from github
Joachim Breitner [Thu, 6 Feb 2014 09:55:30 +0000 (09:55 +0000)] 
Correctly clone submodules from github

(cherry picked from commit b755c7bd6af9f2bee47427b1eaa6c29c72b2b17a)

5 years agoSwitch to relative URLs in .gitmodules
Herbert Valerio Riedel [Thu, 6 Feb 2014 07:42:27 +0000 (08:42 +0100)] 
Switch to relative URLs in .gitmodules

Previously, the `http://`-protocol part was hardcoded in the URLs, causing
the initial clone process to fall back to `http://` even when the ghc.git repo
was cloned via one of the other 3 supported transport protocols.

This is slightly related to #8545, as it will make it possible to e.g.

    git clone --recursive git://

and clone ghc.git including all submodules in one go (i.e. w/o `sync-all`),
and w/o falling back to a different (hardwired) Git transport protocol for
the submodules.

Signed-off-by: Herbert Valerio Riedel <>
(cherry picked from commit ad44e47542a822ac3e02cf514b5d2be52880fc95)

5 years agoadd --with-ar and --with-ranlib configure parameters
Karel Gardas [Sun, 9 Feb 2014 20:58:05 +0000 (21:58 +0100)] 
add --with-ar and --with-ranlib configure parameters

Both --with-ar and --with-ranlib are usable on non-GNU/Linux systems
where GNU tools are usually installed (or possible to install), but
not into standard location nor with standard name. Tested on Solaris 10.

Signed-off-by: Austin Seipp <>
(cherry picked from commit ac24bf45258af701cdd67423d6107357f27bbedf)

5 years agochange deriveConstants to use nm in a POSIX way (fixes #8781)
Karel Gardas [Sat, 22 Mar 2014 21:33:05 +0000 (22:33 +0100)] 
change deriveConstants to use nm in a POSIX way (fixes #8781)

The patch provided by Christian Maeder <>

Signed-off-by: Karel Gardas <>
Signed-off-by: Austin Seipp <>
(cherry picked from commit 045b28033a33a48d31951240a8cb35f2b78345dc)

5 years agoFix #8917.
Richard Eisenberg [Sat, 22 Mar 2014 17:13:26 +0000 (13:13 -0400)] 
Fix #8917.

FamInstEnv.normaliseTcApp should normalise arguments even when
the top-level tycon isn't a type family. This was a regression
from 7.6 -- not sure when it happened, but it was probably my
fault. Fixed now, in any case.

(cherry picked from commit c99941cfeee033fca2df45e9523b65c83be20d31)

5 years agoAdd test case for #8917
Richard Eisenberg [Sat, 22 Mar 2014 16:34:40 +0000 (12:34 -0400)] 
Add test case for #8917

(cherry picked from commit 47796026ca35a2438f7a7dc337add2ec3b14f06c)

5 years agoMark test for #8831 as known-broken
Joachim Breitner [Sat, 22 Mar 2014 10:53:03 +0000 (11:53 +0100)] 
Mark test for #8831 as known-broken

to keep validate working.

(cherry picked from commit 4bc3c8265f988f4456664f502164f52466aab67d)


5 years agotestsuite: add test for #8831
Austin Seipp [Fri, 21 Mar 2014 09:42:32 +0000 (04:42 -0500)] 
testsuite: add test for #8831

Signed-off-by: Austin Seipp <>
(cherry picked from commit f9b6a2bb6574904ab11476d79896491b111ad7cc)


5 years agolinker: Fix indirect calls for x86_64 windows (#2283)
Kyrill Briantsev [Fri, 21 Mar 2014 10:42:48 +0000 (05:42 -0500)] 
linker: Fix indirect calls for x86_64 windows (#2283)

Signed-off-by: Austin Seipp <>
(cherry picked from commit 7a1c85113dd082153cc07f4792216beaf34daeeb)

5 years agoUpdate ghc --help references to --make and a.out (fixes #8600)
ccatalfo [Wed, 12 Mar 2014 02:11:11 +0000 (22:11 -0400)] 
Update ghc --help references to --make and a.out (fixes #8600)

Signed-off-by: Austin Seipp <>
(cherry picked from commit 99ef27913dbe55fa57891bbf97d131e0933733e3)

5 years agoUpdate expected test outputs to match new format of pretty-printing
Dr. ERDI Gergo [Wed, 19 Mar 2014 13:44:38 +0000 (21:44 +0800)] 
Update expected test outputs to match new format of pretty-printing
interface contents

(cherry picked from commit 21028ee6805b896dbbd8a2d46b9690d1adecdcd1)

5 years agoisLexVarSym: check all characters of the name, not just the first one.
Dr. ERDI Gergo [Wed, 19 Mar 2014 12:07:47 +0000 (20:07 +0800)] 
isLexVarSym: check all characters of the name, not just the first one.

This is so that generated names like e.g. workers don't show up as
infix operators when using something like -ddump-simpl.

(cherry picked from commit a3f78e2476e3d4ead86ef3b10ddd4e14e189ada3)

5 years agoAdd test case for #8776
Dr. ERDI Gergo [Fri, 14 Mar 2014 14:34:56 +0000 (22:34 +0800)] 
Add test case for #8776

(cherry picked from commit de32a95ef21970c2db959509861b4f59d1dcbb82)

5 years agoReinstate pretty-printing of AnIds via pprId (#8776)
Dr. ERDI Gergo [Fri, 14 Mar 2014 14:17:45 +0000 (22:17 +0800)] 
Reinstate pretty-printing of AnIds via pprId (#8776)

(cherry picked from commit 52003696ff7a2bbf86fbfccfe29b9f146a1ea549)

5 years agoUse prefix notation in pprIfaceDecl for IfaceIds
Dr. ERDI Gergo [Fri, 14 Mar 2014 13:35:30 +0000 (21:35 +0800)] 
Use prefix notation in pprIfaceDecl for IfaceIds

(cherry picked from commit 5908a7427abd35264f5bafd5bf7bce3a0c9dde8e)

5 years agoHonor Op_PrintExplicitForalls setting in pprIfaceForAllPart
Dr. ERDI Gergo [Fri, 14 Mar 2014 11:50:15 +0000 (19:50 +0800)] 
Honor Op_PrintExplicitForalls setting in pprIfaceForAllPart

(cherry picked from commit f3eeb93529798b80721a9801aa1bf2ea7a1de049)

5 years agoPretty-print the following TyThings via their IfaceDecl counterpart:
Dr. ERDI Gergo [Thu, 13 Mar 2014 13:18:39 +0000 (21:18 +0800)] 
Pretty-print the following TyThings via their IfaceDecl counterpart:
 * AnId
 * ACoAxiom
 * AConLike

(cherry picked from commit 065c35a9d6d48060c8fac8d755833349ce58b35b)

5 years agopprIfaceDecl for IfacePatSyn: use pprPatSynSig
Dr. ERDI Gergo [Wed, 12 Mar 2014 12:38:54 +0000 (20:38 +0800)] 
pprIfaceDecl for IfacePatSyn: use pprPatSynSig

(cherry picked from commit 24eea38c70eae90d166de26d71a178fb0c1ffc30)

5 years agopprIfaceContextArr: print a context including the "=>" arrow
Dr. ERDI Gergo [Wed, 12 Mar 2014 12:38:26 +0000 (20:38 +0800)] 
pprIfaceContextArr: print a context including the "=>" arrow

(cherry picked from commit 23c0f1ec2cf06c0178c2ae7414fe57ea648689e7)

5 years agoAdd OutputableBndr instance for OccName
Dr. ERDI Gergo [Wed, 12 Mar 2014 12:37:22 +0000 (20:37 +0800)] 
Add OutputableBndr instance for OccName

(cherry picked from commit 4d1b7b4a9b986e87755784478b4ea4883a5e203e)