4 years agoSet VERSION=7.8.4, RELEASE=YES ghc-7.8.4-release
Austin Seipp [Tue, 23 Dec 2014 13:47:21 +0000 (07:47 -0600)] 

Signed-off-by: Austin Seipp <>
4 years agoOne _more_ documentation note.
Austin Seipp [Fri, 19 Dec 2014 15:47:54 +0000 (09:47 -0600)] 
One _more_ documentation note.

Signed-off-by: Austin Seipp <>
4 years agoOne more documentation note.
Austin Seipp [Fri, 19 Dec 2014 15:44:50 +0000 (09:44 -0600)] 
One more documentation note.

Signed-off-by: Austin Seipp <>
4 years agoFurther improvements to floating equalities
Simon Peyton Jones [Fri, 18 Jul 2014 08:35:24 +0000 (09:35 +0100)] 
Further improvements to floating equalities

This equality-floating stuff is horribly delicate!  Trac #9316 showed
up yet another corner case.

The main changes are
 * include CTyVarEqs when "growing" the skolem set
 * do not include the kind argument to (~) when growing the skolem set

I added a lot more comments as well

(cherry picked from commit 4b3df0bb705c9287046c07bbc6c038960fbf8d53)

4 years agoAdd package flags to --show-options output
Lennart Kolmodin [Fri, 19 Dec 2014 15:35:21 +0000 (09:35 -0600)] 
Add package flags to --show-options output

Summary: --show-options will now include the package flags.

Test Plan: Pass --show-options to ghc, it should include -package-id.

Reviewers: austin, jstolarek

Subscribers: carter, thomie

Differential Revision:

GHC Trac Issues: #9860

4 years agoMore release notes
Austin Seipp [Fri, 19 Dec 2014 15:32:06 +0000 (09:32 -0600)] 
More release notes

Signed-off-by: Austin Seipp <>
4 years agoFix support for deriving Generic1 for data families (FIX #9563)
Jose Pedro Magalhaes [Fri, 12 Sep 2014 16:44:12 +0000 (17:44 +0100)] 
Fix support for deriving Generic1 for data families (FIX #9563)

(cherry picked from commit 946cbcefab9bc02e12b741e5b070d7521b37ba1a)

4 years agoSet llc and opt commands on all platforms
Austin Seipp [Mon, 1 Sep 2014 20:14:07 +0000 (15:14 -0500)] 
Set llc and opt commands on all platforms

LLVM llc and opt commands should be set on all platforms, including
Windows. If they're not, GHC tries to execute an unnamed executable,
resulting in error messages such as:

    Error (figuring out LLVM version): : runInteractiveProcess: invalid argument (Invalid argument)
    <no location info>:
        Warning: Couldn't figure out LLVM version!
                 Make sure you have installed LLVM

This regression was introduced in e6bfc596.

Test Plan: Build GHC and test if --info shows sensible values of "LLVM llc command" and "LLVM opt command"

Reviewers: austin, #ghc

Reviewed By: austin, #ghc

Subscribers: austin

Projects: #ghc

Differential Revision:

GHC Trac Issues: #7143

(cherry picked from commit 918719b936b878ab660f20ceef8afc9e3a898c5a)

4 years agoTest Trac #9390
Simon Peyton Jones [Thu, 7 Aug 2014 09:08:00 +0000 (10:08 +0100)] 
Test Trac #9390

(cherry picked from commit 2990e97f008c9703eb4b47e24a29d052d5735f00)

4 years agoWhen desugaring Use the smart mkCoreConApps and friends
Simon Peyton Jones [Fri, 1 Aug 2014 15:56:10 +0000 (16:56 +0100)] 
When desugaring Use the smart mkCoreConApps and friends

This is actually the bug that triggered Trac #9390.  We had
an unboxed tuple (# writeArray# ..., () #), and that writeArray#
argument isn't ok-for-speculation, so disobeys the invariant.

The desugaring of unboxed tuples was to blame; the fix is easy.

(cherry picked from commit 1fc60ea1f1fd89b90c2992d060aecb5b5a65f8c0)

4 years agoTest #9371 (indexed-types/should_fail/T9371)
Richard Eisenberg [Sun, 3 Aug 2014 21:54:54 +0000 (17:54 -0400)] 
Test #9371 (indexed-types/should_fail/T9371)

(cherry picked from commit a09508b792eed24fc4d8a363df2635026bfa2de6)

4 years agoFix Trac #9371.
Richard Eisenberg [Sun, 3 Aug 2014 22:40:30 +0000 (18:40 -0400)] 
Fix Trac #9371.

This was very simple: lists of different lengths are
*maybe* apart, not *surely* apart.

(cherry picked from commit f29bdfbcedda6cb33ab05d884c151f2b31f4e4e0)

4 years agoTest #9415 (typecheck/should_fail/T9415)
Richard Eisenberg [Wed, 6 Aug 2014 13:54:37 +0000 (09:54 -0400)] 
Test #9415 (typecheck/should_fail/T9415)

(cherry picked from commit 1a3e19d061c1e5a1db9789572eca3a0ade450954)

4 years agoFix #9415.
Richard Eisenberg [Wed, 6 Aug 2014 13:51:26 +0000 (09:51 -0400)] 
Fix #9415.

Abort typechecking when we detect a superclass cycle error, as
ambiguity checking in the presence of superclass cycle errors can
cause a loop.

(cherry picked from commit 1b1388697e687154c2bf1943639e75f3ccf5bc59)

4 years agofix inconsistency in exported functions from TcSplice.lhs/lhs-boot files when GHCI...
Karel Gardas [Sat, 19 Jul 2014 04:54:52 +0000 (23:54 -0500)] 
fix inconsistency in exported functions from TcSplice.lhs/lhs-boot files when GHCI is not defined

This patch fixes inconsistency in exported functions from TcSplice.lhs and TcSplice.lhs-boot
files. It looks like only GHC HEAD is sensitive to it and complains about it while bootstraping
another HEAD. At least this is what happening on Solaris/AMD64 builder machine where GHC 7.9.20140620
is used as a boostrap compiler. The failure does not happen on another builders.

Test Plan: validate

Reviewers: austin

Reviewed By: austin

Subscribers: phaskell, simonmar, relrod, carter

Differential Revision:

(cherry picked from commit d996a1bb4db84727fbf1a8e9461a032e04e544e7)

4 years fix list for dll-split on GHCi-less builds
Sergei Trofimovich [Sat, 4 Oct 2014 19:48:22 +0000 (20:48 +0100)] fix list for dll-split on GHCi-less builds

To reproduce build failure it's enough to try
to build GHC on amd64 with the following setup:

    $ cat mk/
    # for #9552
    GhcWithInterpreter = NO

It gives:

    Reachable modules from DynFlags out of date
    Please fix compiler/, or building DLLs on Windows may break (#7780)
    Redundant modules: Bitmap BlockId ... <list of 42 modules>
    <make error>

dll-split among other things makes sure
all mentioned modules are used by DynFlags.
'#ifdef GHCI' keeps is from happening.

Patch moves those 42 modules under
'GhcWithInterpreter' guard.

Fixes Issue #9552

Signed-off-by: Sergei Trofimovich <>
(cherry picked from commit 2a8ea4745d6ff79d6ce17961a64d9013243fc3c6)

4 years agoFix detection of GNU gold linker if invoked via gcc with parameters
Sebastian Dröge [Tue, 18 Nov 2014 18:40:20 +0000 (12:40 -0600)] 
Fix detection of GNU gold linker if invoked via gcc with parameters

Previously the linker was called without any commandline parameters to
detect whether bfd or gold is used. However the -fuse-ld parameter can
be used to switch between gold and bfd and should be taken into account

Trac #9336

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

4 years agoMake libffi install into a predictable directory (#9620)
Reid Barton [Sun, 21 Sep 2014 12:53:37 +0000 (08:53 -0400)] 
Make libffi install into a predictable directory (#9620)

On some systems (depending on gcc multilib configuration) libffi
would install into libffi/build/inst/lib64 even though we configure
it with --libdir=libffi/build/inst/lib. There appears to be no way
to get libffi to install to a predictable directory "out of the box",
so we apply a small patch to This is the same fix used
in Gentoo's ebuild (

(cherry picked from commit 835d874df1973b7e1c602a747b42b77095592a9c)

4 years agocabal: Update to fix notorious '-fPIC' bug
Austin Seipp [Mon, 15 Dec 2014 14:49:00 +0000 (08:49 -0600)] 
cabal: Update to fix notorious '-fPIC' bug

This sentence contains the word 'submodule' because it is a requirement.

Signed-off-by: Austin Seipp <>
4 years agocompiler: fix trac issue #9817
Austin Seipp [Mon, 15 Dec 2014 14:44:32 +0000 (08:44 -0600)] 
compiler: fix trac issue #9817

When we call runHandlers, we must pass it a ForeignPtr. To ensure that
this happens, we introduce a wrapper that receives a plain Ptr and
converts it into a ForeignPtr. Then we adjust startSignalHandlers in
rts/posix/Signals.c to call the wrapper instead of calling runHandlers

Reviewers: hvr, austin, rwbarton, simonmar

Reviewed By: austin, simonmar

Subscribers: simonmar, thomie, carter

Differential Revision:

GHC Trac Issues: #9817

(cherry picked from commit 7ca5bb090ff78141fbe275b058a9e35ee496bd58)

4 years agoLink pre-ARMv6 spinlocks into all RTS variants
Joachim Breitner [Wed, 10 Dec 2014 00:18:11 +0000 (18:18 -0600)] 
Link pre-ARMv6 spinlocks into all RTS variants

For compatibility with ARM machines from pre v6, the RTS provides
implementations of certain atomic operations. Previously, these
were only included in the threaded RTS.

But ghc (the library) contains the code in compiler/cbits/genSym.c, which
uses these operations if there is more than one capability. But there is only
one libHSghc, so the linker wants to resolve these symbols in every case.

By providing these operations in all RTSs, the linker is happy. The only
downside is a small amount of dead code in the non-threaded RTS on old ARM

Test Plan: It helped here.

Reviewers: bgamari, austin

Reviewed By: bgamari, austin

Subscribers: carter, thomie

Differential Revision:

GHC Trac Issues: #8951

(cherry picked from commit df1307f079ae69dcd735e0973de987b141d509da)

4 years fix test == bashism
Tuncer Ayaz [Wed, 26 Nov 2014 15:43:19 +0000 (16:43 +0100)] fix test == bashism

Signed-off-by: Austin Seipp <>
4 years agoRemove release notes for IO manager bug
Austin Seipp [Thu, 20 Nov 2014 17:18:55 +0000 (11:18 -0600)] 
Remove release notes for IO manager bug

Signed-off-by: Austin Seipp <>
4 years agoRevert "Revert "Revert "rts/base: Fix #9423"" and resolve issue that caused the revert."
Austin Seipp [Wed, 19 Nov 2014 23:27:54 +0000 (17:27 -0600)] 
Revert "Revert "Revert "rts/base: Fix #9423"" and resolve issue that caused the revert."

This reverts commit 55d2522bd0c48e4c5dac1526cdf53459270baf96.

Signed-off-by: Austin Seipp <>
4 years agoUndo release notes (re: precedence fix)
Austin Seipp [Wed, 5 Nov 2014 21:31:29 +0000 (15:31 -0600)] 
Undo release notes (re: precedence fix)

Signed-off-by: Austin Seipp <>
4 years agoRevert "Use correct precedence when printing contexts with class operators"
Austin Seipp [Wed, 5 Nov 2014 21:30:18 +0000 (15:30 -0600)] 
Revert "Use correct precedence when printing contexts with class operators"

This breaks the build because I am a nincompoop and TyOpPrec doesn't
exit here.

This reverts commit d71f316ef4acb6a967a1f07bc4c1144e553a3ac9.

4 years agoUpdate release notes
Austin Seipp [Wed, 5 Nov 2014 19:04:51 +0000 (13:04 -0600)] 
Update release notes

Signed-off-by: Austin Seipp <>
4 years agoRevert "Revert "rts/base: Fix #9423"" and resolve issue that caused the revert.
Andreas Voellmy [Wed, 5 Nov 2014 19:02:20 +0000 (13:02 -0600)] 
Revert "Revert "rts/base: Fix #9423"" and resolve issue that caused the revert.

This reverts commit 4748f5936fe72d96edfa17b153dbfd84f2c4c053. The fix for #9423
was reverted because this commit introduced a C function setIOManagerControlFd()
(defined in Schedule.c) defined for all OS types, while the prototype
(in includes/rts/IOManager.h) was only included when mingw32_HOST_OS is
not defined. This broke Windows builds.

This commit reverts the original commit and resolves the problem by only defining
setIOManagerControlFd() when mingw32_HOST_OS is defined. Hence the missing prototype
error should not occur on Windows.

In addition, since the io_manager_control_wr_fd field of the Capability struct is only
usd by the setIOManagerControlFd, this commit includes the io_manager_control_wr_fd
field in the Capability struct only when mingw32_HOST_OS is not defined.

Test Plan: Try to compile successfully on all platforms.

Reviewers: austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

(commit cherry picked from 7e658bc14e2dd6baf208deebbdab9e1285ce4c72)

4 years agoRelease note blurb for #9433
Austin Seipp [Mon, 3 Nov 2014 14:26:57 +0000 (08:26 -0600)] 
Release note blurb for #9433

Signed-off-by: Austin Seipp <>
4 years agoCheck for un-saturated type family applications
Simon Peyton Jones [Mon, 25 Aug 2014 14:13:02 +0000 (15:13 +0100)] 
Check for un-saturated type family applications

This patch corrects an egregious error introduced by:

  commit 022f8750edf6f413fba31293435dcc62600eab77
  Author: Simon Peyton Jones <>
  Date:   Thu May 15 16:07:04 2014 +0100

    Refactoring around TyCon.isSynTyCon

    * Document isSynTyCon better
    * Add isTypeSyonymTyCon for regular H98 type synonyms
    * Use isTypeSynonymTyCon rather than isSynTyCon where
      the former is really intended

At this particular spot in TcValidity we really do mean
isSynTyCon and not isTypeSynonymTyCon.

Fixes Trac #9433

(cherry picked from commit ee4501bbad6480509e8a60b5ff89c0b0b228b66d)


4 years agoMake Core Lint check for un-saturated type applications
Simon Peyton Jones [Mon, 25 Aug 2014 14:10:19 +0000 (15:10 +0100)] 
Make Core Lint check for un-saturated type applications

Un-saturated type-family and type-synonym applications are
detected in the front end, but for some reason Lint wasn't
looking for them.

I came across this when wondering why Trac #9433 didn't give
a Core Lint error

(cherry picked from commit 8ff4671422090acf9146e3a90dd38e2c6f72aebb)

4 years agoFix a typo in an error message
Gabor Greif [Tue, 7 Oct 2014 08:20:08 +0000 (10:20 +0200)] 
Fix a typo in an error message

(cherry picked from commit 3c5648afff13e9f6e94dea4094cc3a3fb97baeea)

4 years agoFlesh out release notes.
Austin Seipp [Mon, 3 Nov 2014 14:02:55 +0000 (08:02 -0600)] 
Flesh out release notes.

Signed-off-by: Austin Seipp <>
4 years agoAdd skeleton 7.8.4 release notes
Austin Seipp [Mon, 3 Nov 2014 13:51:38 +0000 (07:51 -0600)] 
Add skeleton 7.8.4 release notes

Signed-off-by: Austin Seipp <>
4 years agornMethodBind: reject pattern synonyms in instance definitions (fixes #9705)
Dr. ERDI Gergo [Tue, 21 Oct 2014 12:51:35 +0000 (20:51 +0800)] 
rnMethodBind: reject pattern synonyms in instance definitions (fixes #9705)

(cherry picked from commit e5ba36080d08791f44e3bed37721f702e242af96)

4 years agoDo not duplicate call information in SpecConstr (Trac #8852)
Simon Peyton Jones [Mon, 25 Aug 2014 11:28:44 +0000 (12:28 +0100)] 
Do not duplicate call information in SpecConstr (Trac #8852)

This long-standing and egregious bug meant that call information was
being gratuitously copied, leading to an exponential blowup in the
number of calls to be examined when function definitions are deeply
nested.  That is what has been causing the blowup in SpecConstr's
running time, not (as I had previously supposed) generating very large code.

See Note [spec_usg includes rhs_usg]

(cherry picked from commit af4bc31c50c873344a2426d4be842f92edf17019)

4 years agoIntroduce the Call data types
Simon Peyton Jones [Mon, 25 Aug 2014 11:24:55 +0000 (12:24 +0100)] 
Introduce the Call data types

This is just a small refactoring that makes the code a bit clearer,
using a data type instead of a triple.  We get better pretty-printing too.

(cherry picked from commit c0fe1d9e7a9f23d050319c77f3a38264f3aa22f8)

4 years agoImprove comments and tracing in SpecConstr
Simon Peyton Jones [Mon, 5 May 2014 07:50:51 +0000 (08:50 +0100)] 
Improve comments and tracing in SpecConstr

(cherry picked from commit 675c5478793ac8cede5daca4f70cd09846879837)

4 years agoUse correct precedence when printing contexts with class operators
Simon Peyton Jones [Thu, 2 Oct 2014 16:47:21 +0000 (17:47 +0100)] 
Use correct precedence when printing contexts with class operators

Fixes Trac #9658

(cherry picked from commit 48089ccf4f1f239b3268b2cb52b8aa0f7356485b)


4 years agotestsuite: mark testwsdeque mark as faulty on NOSMP builds
Sergei Trofimovich [Sat, 23 Aug 2014 08:32:05 +0000 (11:32 +0300)] 
testsuite: mark testwsdeque mark as faulty on NOSMP builds

Signed-off-by: Sergei Trofimovich <>
(cherry picked from commit 2fcb36e41f46f80f75e2f245a1a45457f0f7d6d2)

4 years agotestsuite: disable gcc's warnings about casts of incompatible prototypes in UNREG
Sergei Trofimovich [Sat, 23 Aug 2014 08:01:16 +0000 (11:01 +0300)] 
testsuite: disable gcc's warnings about casts of incompatible prototypes in UNREG

Haskell's 'foreign import' declaraion does not have a way
to extress exact C prototypes (it ignores 'const' modifiers, exact pointer
types, etc.) which leads to warnings when C backend generates calls to such

         warning: conflicting types for built-in function ‘strlen’ [enabled by default]

Patch disables builtin functions for UNREG build
to workaround test failures due to stderr mismatch.

Fixes the following test failures:
    TEST="safePkg01 T5423 T7574 T3736"

Signed-off-by: Sergei Trofimovich <>
(cherry picked from commit fcdd58d2ddcfd8d420adbcb3f20c1d666bc834e6)

4 years agotestsuite: T7815 requires SMP support from ghc
Sergei Trofimovich [Fri, 22 Aug 2014 22:20:11 +0000 (01:20 +0300)] 
testsuite: T7815 requires SMP support from ghc

Signed-off-by: Sergei Trofimovich <>
(cherry picked from commit ff9f4ad38521e54c5284f9bf4599c3baaefeb228)

4 years agox86: zero extend the result of 16-bit popcnt instructions (#9435)
Reid Barton [Tue, 12 Aug 2014 15:11:46 +0000 (11:11 -0400)] 
x86: zero extend the result of 16-bit popcnt instructions (#9435)

The 'popcnt r16, r/m16' instruction only writes the low 16 bits of
the destination register, so we have to zero-extend the result to
a full word as popCnt16# is supposed to return a Word#.

For popCnt8# we could instead zero-extend the input to 32 bits
and then do a 32-bit popcnt, and not have to zero-extend the result.
LLVM produces the 16-bit popcnt sequence with two zero extensions,
though, and who am I to argue?

Test Plan:
 - ran "make TEST=cgrun071 EXTRA_HC_OPTS=-msse42"
 - then ran again adding "WAY=optasm", and verified that
   the popcnt sequences we generate match the ones produced
   by LLVM for its @llvm.ctpop.* intrinsics

Reviewers: austin, hvr, tibbe

Reviewed By: austin, hvr, tibbe

Subscribers: phaskell, hvr, simonmar, relrod, ezyang, carter

Differential Revision:

GHC Trac Issues: #9435

(cherry picked from commit 64151913f1ed32ecfe17fcc40f7adc6cbfbb0bc1)

4 years agoInclude pattern synonyms as AConLikes in the type environment,
Dr. ERDI Gergo [Fri, 29 Aug 2014 13:15:22 +0000 (21:15 +0800)] 
Include pattern synonyms as AConLikes in the type environment,
even for simplified/boot ModDetails (fixes #9417)

(cherry picked from commit f0db1857b053597e9ac43d9ce578e5f5fa0545cb)

4 years agoTake account of the AvailTC invariant when importing
Simon Peyton Jones [Fri, 18 Apr 2014 22:30:18 +0000 (23:30 +0100)] 
Take account of the AvailTC invariant when importing

In the rather gnarly filterImports code, someone had forgotten
the AvailTC invariant:  in AvailTC n [n,s1,s2], the 'n' is itself
included in the list of names.

(cherry picked from commit f964cd9c5c411f8a2383cf2b080581a5c3349661)

4 years agosystools: fix gcc version detecton on non-english locale
Sergei Trofimovich [Mon, 1 Sep 2014 21:06:56 +0000 (00:06 +0300)] 
systools: fix gcc version detecton on non-english locale

ghc runs 'gcc -v' to check if we run under vanilla gcc
or disaguised clang by checking for string

    "gcc version <something>"

But this check does not always work as gcc has that string
localized via gettext mechanism:

    (some gcc's locale strings)
    be.po-msgstr "версія gcc %s\n"
    da.po-msgstr "GCC version %s\n"
    de.po-msgstr "gcc-Version %s %s\n"
    el.po-msgstr "έκδοση gcc %s\n"

To ping gcc to English locale we now override environment
variable with 'LANGUAGE=en' value.

Fixes Issue #8825

Signed-off-by: Sergei Trofimovich <>
Test Plan: validate

Reviewers: austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

GHC Trac Issues: #8825

(cherry picked from commit 4d4d07704ee78221607a18b8118294b0aea1bac4)

4 years agoFix a rare parallel GC bug
Simon Marlow [Thu, 23 Oct 2014 10:12:16 +0000 (11:12 +0100)] 
Fix a rare parallel GC bug

When there's a conflict between two threads evacuating the same TSO,
in some cases we would update the incall->tso pointer to point to the
wrong copy of the TSO.  This would get fixed during the next GC, but
if the thread completed in the meantime, it would likely crash.  We're
seeing this about once per day on a heavily loaded machine (it varies
a lot though).

(cherry picked from commit a11f71eff15ba2706cbb2ee29aaf7350909e0d2f)

4 years agopprC: declare extern cmm primitives as functions, not data
Sergei Trofimovich [Thu, 4 Sep 2014 14:50:45 +0000 (17:50 +0300)] 
pprC: declare extern cmm primitives as functions, not data

  The commit fixes incorrect code generation of
  integer-gmp package on ia64 due to C prototypes mismatch.
  Before the patch prototypes for "foreign import prim" were:
      StgWord poizh[];
  After the patch they became:
      StgFunPtr poizh();

Long story:

Consider the following simple example:

    {-# LANGUAGE MagicHash, GHCForeignImportPrim, UnliftedFFITypes #-}
    module M where
    import GHC.Prim -- Int#
    foreign import prim "poizh" poi# :: Int# -> Int#

Before the patch unregisterised build generated the
following 'poizh' reference:
    EI_(poizh); /* StgWord poizh[]; */
    FN_(M_poizh_entry) {
    // ...

After the patch it looks this way:
    EF_(poizh); /* StgFunPtr poizh(); */
    FN_(M_poizh_entry) {
    // ...

On ia64 it leads to different relocation types being generated:
  incorrect one:
    addl r14 = @ltoffx(poizh#) r14 = [r14], poizh# ; r14 = address-of 'poizh#'
  correct one:
    addl r14 = @ltoff(@fptr(poizh#)), gp ; r14 = address-of-thunk 'poizh#'
    ld8 r14 = [r14]

'@fptr(poizh#)' basically instructs assembler to creates
another obect consisting of real address to 'poizh' instructions
and module address. That '@fptr' object is used as a function "address"
This object is different for every module referencing 'poizh' symbol.

All indirect function calls expect '@fptr' object. That way
call site reads real destination address and set destination
module address in 'gp' register from '@fptr'.

Signed-off-by: Sergei Trofimovich <>
(cherry picked from commit e18525fae273f4c1ad8d6cbe1dea4fc074cac721)

4 years agodriver: pass '-fPIC' option to assembler as well
Sergei Trofimovich [Wed, 27 Aug 2014 19:19:52 +0000 (22:19 +0300)] 
driver: pass '-fPIC' option to assembler as well

Before the patch '-fPIC' was passed only to C compiler,
but not to assembler itself.

It led to runtime crash in GHC_DYNAMIC_PROGRAMS=YES mode
on sparc32.

Technical details are in 'Note [-fPIC for assembler]'.

Signed-off-by: Sergei Trofimovich <>
Test Plan: validate on sparc

Reviewers: simonmar, austin, kgardas

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

(cherry picked from commit a93ab43ab5f40cadbedea2f6342b93c245e91434)

4 years agoUNREG: fix emission of large Integer literals in C codegen
Sergei Trofimovich [Tue, 26 Aug 2014 10:07:14 +0000 (13:07 +0300)] 
UNREG: fix emission of large Integer literals in C codegen

On amd64/UNREG build there is many failing tests trying
to deal with 'Integer' types.

Looking at 'integerConversions' test I've observed
invalid C code generated by GHC.

Cmm code
    CInt a = -1; (a == -1)
yields 'False' with optimisations enabled via the following C code:
    StgWord64 a = (StgWord32)0xFFFFffffFFFFffffu; (a == 0xFFFFffffFFFFffffu)

The patch fixes it by shrinking emitted literals to required sizes:
    StgWord64 a = (StgWord32)0xFFFFffffu; (a == 0xFFFFffffu)

Thanks to Reid Barton for tracking down and fixing the issue.

Signed-off-by: Sergei Trofimovich <>
Test Plan: validate on UNREG build (amd64, x86)

Reviewers: simonmar, rwbarton, austin

Subscribers: hvr, simonmar, ezyang, carter

Differential Revision:

(cherry picked from commit 43f1b2ecd1960fa7377cf55a2b97c66059a701ef)

4 years agorts/Linker.c: declare 'deRefStablePtr' as an exported 'rts' symbol
Sergei Trofimovich [Sat, 23 Aug 2014 10:11:23 +0000 (13:11 +0300)] 
rts/Linker.c: declare 'deRefStablePtr' as an exported 'rts' symbol

    $ inplace/bin/ghc-stage2 -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-package-db -rtsopts -optc-fno-builtin -fno-ghci-history \
        testsuite/tests/ffi/should_run/T4038.hs --interactive -v0 -ignore-dot-ghci +RTS -I0.1 -RTS

    *Main> main
    <interactive>: /tmp/ghc16668_0/ghc16668_5.o: unknown symbol `deRefStablePtr'

The reference to 'deRefStablePtr' is generated by 'compiler/deSugar/DsForeign.lhs':
       = case maybe_target of
          Nothing    -> text "(StgClosure*)deRefStablePtr(the_stableptr)"
          Just hs_fn -> char '&' <> ppr hs_fn <> text "_closure"

Patch fixes all broken tests using 'import wrapper':
    TEST="ffi013 ffi010 ffi011 ffi005 ffi020 ffi006 ffi019 fed001 T1679 T4038"

Tests manifested as broken only in DYNAMIC_GHC_PROGRAMS=NO builds,
where GHCi's custom linker is used instead of system's linker.

Signed-off-by: Sergei Trofimovich <>
(cherry picked from commit 104a66a461f4f89b8e5ad9c829923bb7ca8ceddb)

4 years agoBug #9439: Ensure that stage 0 compiler isn't affected
Ben Gamari [Tue, 19 Aug 2014 02:44:25 +0000 (21:44 -0500)] 
Bug #9439: Ensure that stage 0 compiler isn't affected

Bug #9439 will cause miscompilation of GHC's LLVM backend. Here we
ensure that an affected compiler isn't used to bootstrap.

Test Plan: Attempt to bootstrap GHC with an affected stage 0 compiler.

Reviewers: rwbarton, austin

Reviewed By: austin

Subscribers: simonmar, relrod, ezyang, carter

Differential Revision:

(cherry picked from commit bbd031134a571c1020945b2548e3fc4795b5047a)

4 years agointerruptible() was not returning true for BlockedOnSTM (#9379)
Simon Marlow [Thu, 31 Jul 2014 09:00:16 +0000 (10:00 +0100)] 
interruptible() was not returning true for BlockedOnSTM (#9379)

There's an knock-on fix in HeapStackCheck.c which is potentially
scary, but I'm pretty confident is OK.  See comment for details.

Test Plan:
I've run all the STM
tests I can find, including libraries/stm/tests/stm049 with +RTS -N8
and some of the constants bumped to make it more of a stress test.

Reviewers: hvr, rwbarton, austin

Subscribers: simonmar, relrod, ezyang, carter

Differential Revision:

GHC Trac Issues: #9379

(cherry picked from commit 9d9a55469719908bbd5cd3277e0ac79c0588dc55)

4 years agoA panic in CmmBuildInfoTables.bundle shouldn't be a panic (#9329)
Simon Marlow [Thu, 31 Jul 2014 10:47:16 +0000 (11:47 +0100)] 
A panic in CmmBuildInfoTables.bundle shouldn't be a panic (#9329)

This code needs more comments, but I believe this is safe.  By
definition I can't have broken anything that was working by turning a
panic into a non-panic anyway.

Test Plan: validate

Reviewers: hvr, simonpj, austin

Subscribers: simonmar, relrod, ezyang, carter

Differential Revision:

GHC Trac Issues: #9329

(cherry picked from commit 2989ffdcb88ab24e8a4e8b3d0454497a0db2652c)

4 years agoAllow multiple entry points when allocating recursive groups (#9303)
Simon Marlow [Tue, 22 Jul 2014 11:04:32 +0000 (12:04 +0100)] 
Allow multiple entry points when allocating recursive groups (#9303)

In this example we ended up with some code that was only reachable via
an info table, because a branch had been optimised away by the native
code generator.  The register allocator then got confused because it
was only considering the first block of the proc to be an entry point,
when actually any of the info tables are entry points.

Test Plan: validate

Reviewers: simonpj, austin

Subscribers: simonmar, relrod, carter

Differential Revision:

(cherry picked from commit da70f9ef49a545707dc32db9662441b9c8845fba)

4 years agoAcquire all_tasks_mutex in forkProcess
Edsko de Vries [Sun, 13 Jul 2014 20:19:45 +0000 (15:19 -0500)] 
Acquire all_tasks_mutex in forkProcess

Summary: (for the same reason that we acquire all the other mutexes)

Test Plan: validate

Reviewers: simonmar, austin, duncan

Reviewed By: simonmar, austin, duncan

Subscribers: simonmar, relrod, carter

Differential Revision:

(cherry picked from commit 16403f0d182d2d3d0b1fbe5ad778ead4bfcb7e16)

4 years agoAvoid deadlock in freeTask (called by forkProcess)
Edsko de Vries [Sun, 13 Jul 2014 20:19:39 +0000 (15:19 -0500)] 
Avoid deadlock in freeTask (called by forkProcess)

Summary: Documented in more detail inline with the change.

Test Plan: validate

Reviewers: austin, simonmar, duncan

Reviewed By: austin, simonmar, duncan

Subscribers: simonmar, relrod, carter

Differential Revision:

(cherry picked from commit 39630ab15cc0607103dc4ef3d9089de44ef17c2d)

5 years agoRELEASE=NO
Austin Seipp [Mon, 14 Jul 2014 12:52:27 +0000 (07:52 -0500)] 

Signed-off-by: Austin Seipp <>
5 years agoSet VERSION=7.8.3, RELEASE=YES ghc-7.8.3-release
Austin Seipp [Thu, 10 Jul 2014 00:25:13 +0000 (19:25 -0500)] 

Signed-off-by: Austin Seipp <>
5 years agorts: Fix #9003 with an annoying hack
Austin Seipp [Thu, 10 Jul 2014 00:08:26 +0000 (19:08 -0500)] 
rts: Fix #9003 with an annoying hack

The TL;DR is that by adding this, we can distinguish GHC 7.8.3 from
7.8.2, which had a buggy implementation. See the ticket for details.

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

5 years agoRelease note updates for 7.8.3
Austin Seipp [Fri, 4 Jul 2014 15:13:11 +0000 (10:13 -0500)] 
Release note updates for 7.8.3

Signed-off-by: Austin Seipp <>
5 years agoFix windows breakage (fallout from 34f7e9a3c998)
Austin Seipp [Fri, 4 Jul 2014 14:40:25 +0000 (09:40 -0500)] 
Fix windows breakage (fallout from 34f7e9a3c998)

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

5 years agoAvoid NondecreasingIndentation syntax in ghc-pkg
Herbert Valerio Riedel [Wed, 14 May 2014 10:16:13 +0000 (12:16 +0200)] 
Avoid NondecreasingIndentation syntax in ghc-pkg

This also makes ghc-pkg.cabal `default-extensions`-free

NB: Printing this commit via `git show --ignore-all-spaces` shows the
    only non-whitespaces changes are in `ghc-pkg.cabal`

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


5 years agoPartially fix #9003 by reverting bad numbering.
Edward Z. Yang [Tue, 1 Jul 2014 13:43:50 +0000 (14:43 +0100)] 
Partially fix #9003 by reverting bad numbering.

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

5 years agoFix T7438 output
Austin Seipp [Thu, 3 Jul 2014 21:35:21 +0000 (16:35 -0500)] 
Fix T7438 output

Signed-off-by: Austin Seipp <>
5 years agoAdd Note [Placeholder PatSyn kinds] in TcBinds
Simon Peyton Jones [Tue, 24 Jun 2014 12:24:36 +0000 (13:24 +0100)] 
Add Note [Placeholder PatSyn kinds] in TcBinds

This is just documentation for the fix to Trac #9161

(cherry picked from commit 0757831eaca96c8ebfd99fc51427560d3568cffa)

5 years agoAdd fake entries into the global kind environment for pattern synonyms.
Dr. ERDI Gergo [Sat, 21 Jun 2014 14:37:50 +0000 (22:37 +0800)] 
Add fake entries into the global kind environment for pattern synonyms.

This is needed to give meaningful error messages (instead of internal
panics) when a program tries to lift a pattern synonym into a kind.
(fixes T9161)

(cherry picked from commit aa3166f42361cb605e046f4a063be3f9e1f48015)

5 years agoTest Trac #9023
Simon Peyton Jones [Thu, 5 Jun 2014 11:26:24 +0000 (12:26 +0100)] 
Test Trac #9023

(cherry picked from commit 616f54bdc28ad699f903248a5fb18dc0e5b52a52)

5 years agoMake the matcher and wrapper Ids in PatSyn into LocalIds, not GlobalIds
Simon Peyton Jones [Fri, 6 Jun 2014 10:39:41 +0000 (11:39 +0100)] 
Make the matcher and wrapper Ids in PatSyn into LocalIds, not GlobalIds

This was a serious bug, exposed by Trac #9175.  The matcher and wrapper
must be LocalIds, like record selectors and dictionary functions, for
the reasons now documented in Note [Exported LocalIds] in Id.lhs

In fixing this I found
 - PatSyn should have an Id inside it (apart from the wrapper and matcher)
   It should be a Name.  Hence psId --> psName, with knock-on consequences

 - Tidying of PatSyns in TidyPgm was wrong

 - The keep-alive set in Desugar.deSugar (now) doesn't need pattern synonyms
   in it

I also cleaned up the interface to PatSyn a little, so there's a tiny knock-on
effect in Haddock; hence the haddock submodule update.

It's very hard to make a test for this bug, so I haven't.

(cherry picked from commit 7ac600d5fcd74db1f991555de6e415030970d5f3)


5 years agoPrint for-alls more often (Trac #9018)
Simon Peyton Jones [Mon, 28 Apr 2014 13:49:21 +0000 (14:49 +0100)] 
Print for-alls more often (Trac #9018)

We now display the foralls of a type if any of the type variables
is polykinded.  This put kind polymorphism "in your face" a bit more
often, but eliminates a lot of head scratching.

The user manual reflects the new behaviour.

(cherry picked from commit 2f3ea95285d0cccc2a999e7572d8fb78dc2ea441)


5 years agoFix egregious instantiation bug in matchOneConLike (fixing Trac #9023)
Simon Peyton Jones [Thu, 5 Jun 2014 10:03:45 +0000 (11:03 +0100)] 
Fix egregious instantiation bug in matchOneConLike (fixing Trac #9023)

We simply weren't giving anything like the right instantiating types
to patSynInstArgTys in matchOneConLike.

To get these instantiating types would have involved matching the
result type of the pattern synonym with the pattern type, which is
tiresome.  So instead I changed ConPatOut so that instead of recording
the type of the *whole* pattern (in old field pat_ty), it not records
the *instantiating* types (in new field pat_arg_tys).  Then we canuse
TcHsSyn.conLikeResTy to get the pattern type when needed.

There are lots of knock-on incidental effects, but they mostly made
the code simpler, so I'm happy.

(cherry picked from commit 0a55a3cada2fea37586b1a270c1511ed9957dbd4)

5 years agoImprove tracing slightly
Simon Peyton Jones [Tue, 8 Apr 2014 08:41:20 +0000 (09:41 +0100)] 
Improve tracing slightly

(cherry picked from commit cbe59d89f2f1cc41147fabb4a4c58126152bef7f)

5 years agoStore IfExtNames for PatSyn matchers and wrappers in interface file.
Dr. ERDI Gergo [Tue, 27 May 2014 13:16:41 +0000 (21:16 +0800)] 
Store IfExtNames for PatSyn matchers and wrappers in interface file.
This way, the Ids for the matchers/wrappers are reused by importing
modules, and thus unfoldings are kept.

Also updates haddock submodule to accomodate tweaks in PatSyn representation

(cherry picked from commit ac2796e6ddbd54c5762c53e2fcf29f20ea162fd5)


5 years agoInstead of tracking Origin in LHsBindsLR, track it in MatchGroup
Dr. ERDI Gergo [Sat, 12 Apr 2014 11:36:31 +0000 (19:36 +0800)] 
Instead of tracking Origin in LHsBindsLR, track it in MatchGroup

(cherry picked from commit eeaea2df3fa585db503034f419c6e4331a4d8a84)

5 years agoExpected output of as-pattern test
Dr. ERDI Gergo [Sat, 12 Apr 2014 09:52:26 +0000 (17:52 +0800)] 
Expected output of as-pattern test

(cherry picked from commit 7233638ba6e82179cc4bd1b981eff5292b18e118)

5 years agoAdd source file for new test that checks that as-patterns are rejected
Dr. ERDI Gergo [Sat, 12 Apr 2014 08:35:44 +0000 (16:35 +0800)] 
Add source file for new test that checks that as-patterns are rejected
in pattern synonym definitions

(cherry picked from commit dd3a6d270f827a59f7a33f32facc506cb35af1fa)

5 years agoRemove unused variable binding to fix validate
Dr. ERDI Gergo [Sat, 12 Apr 2014 00:57:27 +0000 (08:57 +0800)] 
Remove unused variable binding to fix validate

(cherry picked from commit b7f51d60093ea13d0854bd7e1d4ecf58d12628a1)

5 years agoSplit off pattern synonym definition checking from pattern inversion
Dr. ERDI Gergo [Thu, 10 Apr 2014 14:13:00 +0000 (22:13 +0800)] 
Split off pattern synonym definition checking from pattern inversion

(cherry picked from commit c269b7e85524f4a8be3cd0f00e107207ab9197af)

5 years agoAdd comments & notes explaining the typing of pattern synonym definitions
Dr. ERDI Gergo [Tue, 8 Apr 2014 14:29:23 +0000 (22:29 +0800)] 
Add comments & notes explaining the typing of pattern synonym definitions

(cherry picked from commit d2c4f9758ca735f294033401efef225699c292f8)

5 years agoUpdate documentation
Jan Stolarek [Thu, 3 Jul 2014 06:16:28 +0000 (08:16 +0200)] 
Update documentation

  * fix links to the User's Guide in ghc and ghci --help messages
  * fix default stack size info in RTS help message

(cherry picked from commit 311c55d132a65e657771e5f58b12a205e0a4af99)

5 years agoMark HPC ticks labels as dynamic
Reid Barton [Tue, 1 Jul 2014 05:04:18 +0000 (01:04 -0400)] 
Mark HPC ticks labels as dynamic

This enables GHC's PIC machinery for accessing tickboxes of other
packages correctly when building dynamic libraries. Previously
GHC was doing strange and wrong things in that situation. See #9012.

(cherry picked from commit 3285a3d5bc7419464f5d2e6cef7c3adb9bca65c3)

5 years agoAdd missing test file T7269
Simon Peyton Jones [Mon, 26 May 2014 16:03:23 +0000 (17:03 +0100)] 
Add missing test file T7269

(cherry picked from commit db869e7521387db0513d1dc2b49641ce32688cdd)

5 years agoFix yet another bug in 'deriving' for polykinded classes (Trac #7269)
Simon Peyton Jones [Wed, 2 Jul 2014 17:47:11 +0000 (12:47 -0500)] 
Fix yet another bug in 'deriving' for polykinded classes (Trac #7269)

This patch makes the code a bit simpler if anything.

(cherry picked from commit b1436f55da2b0e005ac09be6651a2c4d934027ec)

5 years agoWibble to 4cfc1fae
Simon Peyton Jones [Tue, 13 May 2014 23:15:48 +0000 (00:15 +0100)] 
Wibble to 4cfc1fae

isSynTyCon is true of type *family* TyCons, which *are* allowed
in TyConAppCo

(cherry picked from commit 3fd7f543efe977de6f3cce9fcdfdad8b6825f948)

5 years agoRefactoring around TyCon.isSynTyCon
Simon Peyton Jones [Wed, 2 Jul 2014 17:18:41 +0000 (12:18 -0500)] 
Refactoring around TyCon.isSynTyCon

* Document isSynTyCon better
* Add isTypeSyonymTyCon for regular H98 type synonyms
* Use isTypeSynonymTyCon rather than isSynTyCon where
  the former is really intended

All arose as part of a bug I introduced when fixing Trac #9102,
thinking that isSynTyCon meant H98 type syononyms.

(cherry picked from commit 022f8750edf6f413fba31293435dcc62600eab77)

5 years agoFix invariant in mkAppCoFlexible
Simon Peyton Jones [Tue, 13 May 2014 12:17:19 +0000 (13:17 +0100)] 
Fix invariant in mkAppCoFlexible

mkAppCoFlexible was breaking the invariant that the head of a TyConAppCo cannot
be a type synonym.  This small patch fixes it.

(cherry picked from commit 21f17d06aa5c33e639f1b0d37b4bf888b494c441)

5 years agoLint should check that TyConAppCo doesn't have a synonym in the tycon position
Simon Peyton Jones [Tue, 13 May 2014 12:15:45 +0000 (13:15 +0100)] 
Lint should check that TyConAppCo doesn't have a synonym in the tycon position

That is why Lint didn't nail Trac #9102

(cherry picked from commit 4cfc1fae11ec9a5c4b34ac747f0ce50f52423eba)

5 years agoComment the expect_broken for Trac #9208
Simon Peyton Jones [Mon, 23 Jun 2014 16:37:56 +0000 (17:37 +0100)] 
Comment the expect_broken for Trac #9208

(cherry picked from commit 8a0aa198f78cac1ca8d0695bd711778e8ad086aa)

5 years agoMark T9208 as broken when debugging is on
Joachim Breitner [Mon, 23 Jun 2014 15:50:47 +0000 (08:50 -0700)] 
Mark T9208 as broken when debugging is on

this seems to be expected, as explained by SPJ in comment 7 of #9208.

(cherry picked from commit 518ada5cda08d3256826ed0383888111f8096de5)

5 years agoTest #9085.
Richard Eisenberg [Wed, 11 Jun 2014 12:29:27 +0000 (08:29 -0400)] 
Test #9085.

(cherry picked from commit f502617065c8716a062c83fc923c3b3a2395c4a8)

5 years agoFix #9085.
Richard Eisenberg [Tue, 10 Jun 2014 19:25:36 +0000 (15:25 -0400)] 
Fix #9085.

Inaccessible equations in a closed type family now leads to a
warning, not an error. This echoes what happens at the term level.

(cherry picked from commit 6a1d7f9736098d47463a71323d28ece792a59e52)

5 years agoCheck for integer overflow in allocate() (#9172)
Reid Barton [Tue, 1 Jul 2014 14:20:31 +0000 (10:20 -0400)] 
Check for integer overflow in allocate() (#9172)

Summary: Check for integer overflow in allocate() (#9172)

Test Plan: validate

Reviewers: austin

Reviewed By: austin

Subscribers: simonmar, relrod, carter

Differential Revision:

(cherry picked from commit db64180896b395283f443d66a308048c605b217d)


5 years agoTest Trac #9222
Simon Peyton Jones [Tue, 1 Jul 2014 14:23:30 +0000 (15:23 +0100)] 
Test Trac #9222

(cherry picked from commit 127c45ea30eaee6b5244b3f30aaa701d0ad327ac)


5 years agoIn TcValidity.checkAmbiguity, skolemise kind vars that appear free in the kinds of...
Simon Peyton Jones [Tue, 24 Jun 2014 21:23:29 +0000 (22:23 +0100)] 
In TcValidity.checkAmbiguity, skolemise kind vars that appear free in the kinds of type variables

This was shown up by Trac #9222.

(cherry picked from commit 2be99d2309471bc75ddb9cb47acda9ccbcb7ab63)

5 years agoFix demand analyser for unboxed types
Simon Peyton Jones [Tue, 1 Jul 2014 12:31:18 +0000 (13:31 +0100)] 
Fix demand analyser for unboxed types

This is a tricky case exposed by Trac #9254.  I'm surprised it hasn't
shown up before, because it's happens when you use unsafePerformIO in
the right way.

Anyway, fixed now.  See Note [Analysing with absent demand]
in Demand.lhs

(cherry picked from commit d6ee82b29598dcc1028773dd987b7a2fb17519b7)

5 years agoRemove extraneous debugging output (#9071)
Reid Barton [Mon, 30 Jun 2014 21:27:14 +0000 (17:27 -0400)] 
Remove extraneous debugging output (#9071)

(cherry picked from commit c44da48c6d19b3d8cc0ba34328576683410f8ec2)

5 years agoControl CPP through settings file (#8683)
Carter Tazio Schonwald [Wed, 2 Jul 2014 13:52:53 +0000 (08:52 -0500)] 
Control CPP through settings file (#8683)

Allow the CPP program and flag choices for GHC
be configured via the the ghc settings file

Test Plan: ran validate yesterday

Reviewers: hvr, austin, mzero, simonmar

Reviewed By: austin, mzero, simonmar

Subscribers: mzero, simonmar, relrod, carter

Differential Revision:

(cherry picked from commit 34f7e9a3c99850859901ca74370f55f1d4e2279a)

5 years agoFix T9160 under ./validate
Austin Seipp [Wed, 2 Jul 2014 15:27:16 +0000 (10:27 -0500)] 
Fix T9160 under ./validate

Signed-off-by: Austin Seipp <>
5 years agoFix merge fallout, killing validate
Austin Seipp [Mon, 30 Jun 2014 13:42:15 +0000 (08:42 -0500)] 
Fix merge fallout, killing validate

Signed-off-by: Austin Seipp <>
5 years agoFix elemLocalRdrEnv (Trac #9160)
Simon Peyton Jones [Thu, 12 Jun 2014 15:42:37 +0000 (16:42 +0100)] 
Fix elemLocalRdrEnv (Trac #9160)

This was pretty obscure.  elemLocalRdrEnv was utterly wrong (replied
False when it should reply True) when given an Exact Name. That
doesn't happen often, but it does happen in the result of a TH splice.
The result was that an associated type didn't get a type variable that
lined up with its parent class (elemLocalRdrEnv is used in
RnTypes.bindHsTyVars), and that messed up the singletons package.

I've made a completely different test case to show up the bug:

I also refactored RdrName.LocalRdrEnv to be a record with named
fields, which makes the code more robust and easy to understand.

(cherry picked from commit b637585dcbfc1ba53aa49bcb9b730cd08fea4b59)