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

4 years agolibffi: backport noexecstack fix for x86/win32.S
Sergei Trofimovich [Thu, 2 Apr 2015 21:02:57 +0000 (22:02 +0100)] 
libffi: backport noexecstack fix for x86/win32.S

Got detected by gentoo's QA preinstall hook:
 * RWX --- --- usr/lib/ghc-7.10.1/rts/
 * RWX --- --- usr/lib/ghc-7.10.1/rts/
 * RWX --- --- usr/lib/ghc-7.10.1/rts/
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_p.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_l.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_debug.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_debug.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_l.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_p.a:win32.o

Signed-off-by: Sergei Trofimovich <>
Test Plan: built ghc-7.10.1 binary and checked stacks as NX

Reviewers: rwbarton, hvr, austin

Reviewed By: austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10208

4 years agoChange 'Tab character' warnings so there is one per file (#9723)
Dave Laing [Thu, 2 Apr 2015 16:51:46 +0000 (18:51 +0200)] 
Change 'Tab character' warnings so there is one per file (#9723)

Reviewed By: nomeata, thomie

Differential Revision:

Signed-off-by: Dave Laing <>
4 years agoDisable same warnings for normal builds as for validate (#10223)
Thomas Miedema [Thu, 2 Apr 2015 09:41:47 +0000 (11:41 +0200)] 
Disable same warnings for normal builds as for validate (#10223)

The default validate settings currently disable some warnings in the
libraries. This patch moves those settings to a new file called
`mk/`, and applies them also to normal builds.

Through uncommenting a line in, developers can now build with

-Werror is not the default, because:
* We can not guarantee that the build is warning free on platforms we
  don't run regularly run validate (as part of continuous integration
  systems), and we still want the build to go through on those
* quoting rwbarton on irc > "I think -Werror by default has come up in
  the past and the argument was that it is too annoying when you are
  doing nontrivial development"

Reviewed By: austin

Differential Revision:

4 years agoDo not set -fasm explicitly in (#10223)
Thomas Miedema [Thu, 2 Apr 2015 09:39:54 +0000 (11:39 +0200)] 
Do not set -fasm explicitly in (#10223)

On platforms that support -fasm, it is already the default, so we don't
have to set it.

Reviewed By: austin, erikd (tested on powerpc and armhf)

Differential Revision:

4 years agoFake (->) fixity declaration (#10145)
Oleg Grenrus [Thu, 2 Apr 2015 09:28:03 +0000 (11:28 +0200)] 
Fake (->) fixity declaration (#10145)

Reviewed By: simonpj, austin

Differential Revision:

4 years agoIndentation only.
Edward Z. Yang [Sun, 29 Mar 2015 05:34:32 +0000 (22:34 -0700)] 
Indentation only.

Signed-off-by: Edward Z. Yang <>
4 years agoFilter out `-Rghc-timing` for V=0 builds (#10223)
Thomas Miedema [Wed, 1 Apr 2015 17:30:16 +0000 (19:30 +0200)] 
Filter out `-Rghc-timing` for V=0 builds (#10223)

Reviewed By: austin

Differential Revision:

4 years agoReformat build flavours in (#10223)
Thomas Miedema [Wed, 1 Apr 2015 17:24:13 +0000 (19:24 +0200)] 
Reformat build flavours in (#10223)

Use same format for each build flavour, to make it easier to compare
them. Refactoring only.

Reviewed By: austin

Differential Revision:

4 years agoChange which files --make thinks are 'Haskellish' (#10220)
Thomas Miedema [Wed, 1 Apr 2015 17:22:28 +0000 (19:22 +0200)] 
Change which files --make thinks are 'Haskellish' (#10220)

`.hspp` and `.hscpp` are haskell files that have already been preprocessed.

Treat `.hspp` and `.hscpp` as Haskellish sources again, as they were before
commit a10e1990. This way, ghc --make will load their imports.

Make sure that `.cmm` and `.cmmcpp` are still not treated as Haskellish,
by moving them out of `haskell_src_suffixes` (but still keeping them in
haskellish_suffixes, though I'm not sure what the purpose of that group

Reviewed By: austin

Differential Revision:

4 years agoDon't `make accept` output of expect_broken tests
Thomas Miedema [Wed, 1 Apr 2015 15:28:39 +0000 (17:28 +0200)] 
Don't `make accept` output of expect_broken tests

When running `make accept` on a directory in the testsuite, don't accept
the output of tests that are marked as expect_broken. This makes it
easier to review `git diff` after running `make accept`.

When you change an error message in the compiler that shows up in the
output of many tests, you can run `make accept` in the testsuite
directory, and all expected test output will be updated. But since your
change didn't magically fix all the other bugs in the compiler for which
we have an expect_broken test, the output for those tests should
probably not be updated.

Before, the effect of running `make accept` could be that some tests
would end up in the 'unexpected passes' group.

[skip ci]

Reviewed By: austin

Differential Revision:

4 years agouBackpack: simplified Backpack description.
Edward Z. Yang [Tue, 24 Mar 2015 19:28:16 +0000 (12:28 -0700)] 
uBackpack: simplified Backpack description.

Signed-off-by: Edward Z. Yang <>
4 years agoTestsuite: redirect stderr to /dev/null when running GS on
Thomas Miedema [Tue, 31 Mar 2015 12:12:52 +0000 (14:12 +0200)] 
Testsuite: redirect stderr to /dev/null when running GS on

This is a followup to a3d0a7a0ba3a1ee458a9883011247561dfe22f4a.

Reviewed by: Rufflewind

Differential Revision:

4 years agoDon't treat .hcr and .raw_s as haskellish suffixes
Thomas Miedema [Tue, 31 Mar 2015 10:15:34 +0000 (12:15 +0200)] 
Don't treat .hcr and .raw_s as haskellish suffixes

.hcr: external core
.raw_s: direct output from the c compiler, back in the day

Reviewed By: austin

Differential Revision:

4 years agoDon't throw exception when start_phase==stop_phase (#10219)
Thomas Miedema [Tue, 31 Mar 2015 10:12:24 +0000 (12:12 +0200)] 
Don't throw exception when start_phase==stop_phase (#10219)

Just do nothing instead. This bug only shows up when using `-x hspp` in
--make mode on registerised builds.

Reviewed By: austin

Differential Revision:

4 years agoExplicitly check for -C on registerised build (#7563)
Thomas Miedema [Tue, 31 Mar 2015 10:11:08 +0000 (12:11 +0200)] 
Explicitly check for -C on registerised build (#7563)

Show a more descriptive error message.

Reviewed By: austin

Differential Revision:

4 years agoTestsuite: suppress errors when running GS on
Phil Ruffwind [Tue, 31 Mar 2015 10:04:50 +0000 (12:04 +0200)] 
Testsuite: suppress errors when running GS on

Suppress the errors that appear in standard output when running gs on since it's expected to fail anyway.

Reviewed By: thomie, austin

Differential Revision:

4 years agoDrop old integer-gmp-0.5 from GHC source tree
Herbert Valerio Riedel [Sun, 29 Mar 2015 17:02:08 +0000 (19:02 +0200)] 
Drop old integer-gmp-0.5 from GHC source tree

This completes what c774b28f76ee4c220f7c1c9fd81585e0e3af0e8a (#9281)
started.  `integer-gmp-1.0` was added as an additional
`libraries/integer-gmp2` folder while retaining the ability to configure
GHC w/ the old `integer-gmp-0.5` to have a way back, and or the ability
to easily switch between old/new `integer-gmp` for benchmark/debugging

This commit removes the old `libraries/integer-gmp` folder and moves
`libraries/integer-gmp2` into its place, while removing any mentions of
"gmp2" as well as the to support two different `integer-gmp` packages in
GHC's source-tree.

Reviewed By: austin

Differential Revision:

4 years agoAdd `integer-gmp` specific hint to
Herbert Valerio Riedel [Tue, 31 Mar 2015 08:54:15 +0000 (10:54 +0200)] 
Add `integer-gmp` specific hint to

[skip ci]

4 years agoSyntax check package-qualified imports (#9225)
Thomas Miedema [Mon, 30 Mar 2015 22:41:23 +0000 (00:41 +0200)] 
Syntax check package-qualified imports (#9225)

Version numbers are not allowed in the package name of a
package-qualified import.

Reviewed By: austin, ezyang

Differential Revision:

4 years agoDelete unused field `PipeEnv.pe_isHaskellishFile`
Thomas Miedema [Mon, 30 Mar 2015 21:05:16 +0000 (23:05 +0200)] 
Delete unused field `PipeEnv.pe_isHaskellishFile`

Differential Revision:

4 years agoRemove an unused include that doesn't exist on OS X (#10211)
Dave Laing [Mon, 30 Mar 2015 11:02:33 +0000 (13:02 +0200)] 
Remove an unused include that doesn't exist on OS X (#10211)

Differential Revision:

4 years agoRefactor the story around switches (#10137)
Joachim Breitner [Mon, 30 Mar 2015 08:20:14 +0000 (10:20 +0200)] 
Refactor the story around switches (#10137)

This re-implements the code generation for case expressions at the Stg →
Cmm level, both for data type cases as well as for integral literal
cases. (Cases on float are still treated as before).

The goal is to allow for fancier strategies in implementing them, for a
cleaner separation of the strategy from the gritty details of Cmm, and
to run this later than the Common Block Optimization, allowing for one
way to attack #10124. The new module CmmSwitch contains a number of
notes explaining this changes. For example, it creates larger
consecutive jump tables than the previous code, if possible.

nofib shows little significant overall improvement of runtime. The
rather large wobbling comes from changes in the code block order
(see #8082, not much we can do about it). But the decrease in code size
alone makes this worthwhile.

        Program           Size    Allocs   Runtime   Elapsed  TotalMem
            Min          -1.8%      0.0%     -6.1%     -6.1%     -2.9%
            Max          -0.7%     +0.0%     +5.6%     +5.7%     +7.8%
 Geometric Mean          -1.4%     -0.0%     -0.3%     -0.3%     +0.0%

Compilation time increases slightly:
        -1 s.d.                -----            -2.0%
        +1 s.d.                -----            +2.5%
        Average                -----            +0.3%

The test case T783 regresses a lot, but it is the only one exhibiting
any regression. The cause is the changed order of branches in an
if-then-else tree, which makes the hoople data flow analysis traverse
the blocks in a suboptimal order. Reverting that gets rid of this
regression, but has a consistent, if only very small (+0.2%), negative
effect on runtime. So I conclude that this test is an extreme outlier
and no reason to change the code.

Differential Revision:

4 years agoRenames some files to help with validation cleanup (#10212)
Dave Laing [Mon, 30 Mar 2015 07:21:13 +0000 (09:21 +0200)] 
Renames some files to help with validation cleanup (#10212)

Test Plan: validate twice

Reviewed by: thomie

Differential Revision:

4 years agoDoc typofix.
Edward Z. Yang [Sun, 29 Mar 2015 03:57:20 +0000 (20:57 -0700)] 
Doc typofix.

Signed-off-by: Edward Z. Yang <>
4 years agoRename C(obj)cplusplus to C(obj)cxx
Thomas Miedema [Sat, 28 Mar 2015 00:27:59 +0000 (01:27 +0100)] 
Rename C(obj)cplusplus to C(obj)cxx

Reviewed By: kgardas

Differential Revision:

4 years agoRename driver phases C(obj)cpp to C(obj)cplusplus
Thomas Miedema [Fri, 27 Mar 2015 20:37:49 +0000 (21:37 +0100)] 
Rename driver phases C(obj)cpp to C(obj)cplusplus

Cpp     = Pre-process C
Ccpp    = Compile C++
Cobjcpp = Compile Objective-C++
CmmCpp  = Pre-process Cmm

Quite confusing! This commit renames `Ccpp` to `Ccplusplus`, and
`Cobjcpp` to `Cobjcplusplus`. The two letters `p-p` keep standing for
`pre-processing` throughout the compiler.

Reviewed By: austin

Differential Revision:

4 years agoUpdate list of primops that don't get wrappers (#10191)
Reid Barton [Fri, 27 Mar 2015 04:09:23 +0000 (00:09 -0400)] 
Update list of primops that don't get wrappers (#10191)

The list was 14 years old, and there don't seem to be any problems
with seq# or par#; the other par*# primops were not actually
implemented at all and were removed in D758.

Test Plan:
validate; will also try to locally validate an unregisterised build
in case there was some truth to the deleted comment

Reviewers: austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10191

4 years agoRemove some unimplemented GranSim primops
Reid Barton [Fri, 27 Mar 2015 15:25:19 +0000 (11:25 -0400)] 
Remove some unimplemented GranSim primops

An attempt to use these resulted in an error like:

[1 of 1] Compiling Main             ( p.hs, p.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 7.8.4 for x86_64-unknown-linux):
emitPrimOp: can't translate PrimOp  parAt#{v}

Test Plan: validate

Reviewers: thomie, austin

Reviewed By: thomie, austin

Subscribers: thomie

Differential Revision:

4 years agoFix Git-commit-id detection for RELEASE=YES
Herbert Valerio Riedel [Thu, 26 Mar 2015 21:39:52 +0000 (22:39 +0100)] 
Fix Git-commit-id detection for RELEASE=YES

By mistake, the Git-commit-id detection was only enabled for
`RELEASE=NO` (since the date-based GHC version computation is
only active in that case). With this commit the commit-id
detection is active regardless of the `RELEASE`-setting.

This is a follow-up to 73e5e2f8bade2d8b2b1ecae958fe12d0b24591ef

4 years agoAdd Monad instance for `((,) a)` (#10190)
Fumiaki Kinoshita [Wed, 25 Mar 2015 04:30:25 +0000 (13:30 +0900)] 
Add Monad instance for `((,) a)` (#10190)

This was proposed a couple of times in the past, e.g.


but its implementation had been blocked by the fact that `Monoid` wasn't
in scope where the `Monad` class was defined. Since the AMP/FTP restructuring
this is no longer the case.

4 years agoMore comments (related to Trac #10180)
Simon Peyton Jones [Tue, 24 Mar 2015 13:52:20 +0000 (13:52 +0000)] 
More comments (related to Trac #10180)

4 years agoImprove environment handling in TcBinds
Simon Peyton Jones [Tue, 24 Mar 2015 12:52:29 +0000 (12:52 +0000)] 
Improve environment handling in TcBinds

This is a minor refactoring, but it simplifies the code quite a bit

* Decrease the number of variants of tcExtend in TcEnv
* Remove "not_actually_free" from TcEnv.tc_extend_local_env2
* Simplify plumbingof the "closed" flag
* Remove redundant scoping of wild-card variables

4 years agoSome stress tests for the empty case linter
Joachim Breitner [Tue, 24 Mar 2015 10:28:55 +0000 (11:28 +0100)] 
Some stress tests for the empty case linter

This is a variation of T2431 where the emptyness of the type is hidden
behind a newtype, a type family and a closed type family. In all cases,
it would be sound for the compiler to determine that the equality type
is empty and the case alternatives may be dropped.

At the moment, GHC does _not_ determine that. But if it ever does, this
test ensures that we do not forget to make the lint from #10180 smarter
as well.

4 years agoDelete DynFlag for NDP way
Thomas Miedema [Tue, 24 Mar 2015 10:09:43 +0000 (11:09 +0100)] 
Delete DynFlag for NDP way

The last trace of NDP was removed in 2008 in commit:

NDP stood for 'Nested Data Parallelism'. It was superseded by Data
Parallel Haskell (DPH).

Reviewed By: austin

Differential Revision:

4 years agoEmpty alternative lint check: Explain why there are two checks
Joachim Breitner [Tue, 24 Mar 2015 08:37:31 +0000 (09:37 +0100)] 
Empty alternative lint check: Explain why there are two checks

This addresses
[skip ci]

4 years agoexprIsBottom: Make use of isEmptyTy (#10186)
Joachim Breitner [Mon, 23 Mar 2015 21:25:24 +0000 (22:25 +0100)] 
exprIsBottom: Make use of isEmptyTy (#10186)

Any expression with of empty type is necessary bottom, so we can use
that here. No effects known, but it is the right thing to do and
validate, so lets do it.

Differential Revision:

4 years agoFix bug in hs-libraries field munging.
Edward Z. Yang [Wed, 18 Mar 2015 22:28:29 +0000 (15:28 -0700)] 
Fix bug in hs-libraries field munging.

Signed-off-by: Edward Z. Yang <>
Test Plan: validate with 7.8 stage0 and HEAD stage0

Reviewers: austin, kgardas

Subscribers: thomie

Differential Revision:

4 years agoDo version specific detection of LLVM tools (#10170).
Erik de Castro Lopo [Fri, 20 Mar 2015 01:16:23 +0000 (12:16 +1100)] 
Do version specific detection of LLVM tools (#10170).

The LLVM developers seem to make breaking changes in the LLVM IR
language between major releases. As a consumer of the LLVM tools
GHC now needs to be locked more tightly to a single version of
the LLVM tools.

GHC HEAD currently only supports LLVM version 3.6. This commit
changes the configure script to look for `llc-3.6` and `opt-3.6`
before looking for `llc` and `opt`. If the former are not found,
but the later are, check that they actually are version 3.6.

At the same time, when detecting known problems with the LLVM
tools (ie #9439) test for it using the versions of the LLVM tools
retrieved from the bootstrap compiler's settings file.

Test Plan: Manual testing.

Reviewers: thomie, rwbarton, nomeata, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10170

4 years agoisEmptyTy: Improve comment
Joachim Breitner [Mon, 23 Mar 2015 21:19:21 +0000 (22:19 +0100)] 
isEmptyTy: Improve comment

[skip ci]

4 years agoAdd Note [No alternatives lint check]
Joachim Breitner [Mon, 23 Mar 2015 21:16:08 +0000 (22:16 +0100)] 
Add Note [No alternatives lint check]

in a follow up to #10180.

4 years agoNew lint check: Check idArity invariants (#10181)
Joachim Breitner [Sun, 22 Mar 2015 16:51:51 +0000 (17:51 +0100)] 
New lint check: Check idArity invariants (#10181)

The arity of an id should not be larger than what the type allows, and
it should also not contradict the strictness signature. This adds a lint
check for that.

This broke test T8743, uncovering a bug in the SOURCE import machinery,
which is now filed as #10182.

4 years agoNew Lint check: no alternatives implies bottoming expression
Joachim Breitner [Sun, 22 Mar 2015 16:32:26 +0000 (17:32 +0100)] 
New Lint check: no alternatives implies bottoming expression

detected either by exprIsBottom or by an empty type.

This was suggested by SPJ and fixes #10180.

4 years agoexprIsBottom should look through type lambdas
Joachim Breitner [Mon, 23 Mar 2015 09:17:25 +0000 (10:17 +0100)] 
exprIsBottom should look through type lambdas

as evaluting (\ (@ a) -> e) diverges if and only if evaluating e
diverges. This was found in the context of #10180.

4 years agoDo proper depth checking in the flattener to avoid looping.
Richard Eisenberg [Mon, 23 Mar 2015 14:30:19 +0000 (10:30 -0400)] 
Do proper depth checking in the flattener to avoid looping.

This implements (roughly) the plan put forward in comment:14:ticket:7788,
fixing #7788, #8550, #9554, #10139, and addressing concerns raised in #10079.
There are some regressions w.r.t. GHC 7.8, but only with pathological type
families (like F a = F a). This also (hopefully -- don't have a test case)
fixes #10158. Unsolved problems include #10184 and #10185, which are both
known deficiencies of the approach used here.

As part of this change, the plumbing around detecting infinite loops has
changed. Instead of -fcontext-stack and -ftype-function-depth, we now have
one combined -freduction-depth parameter. Setting it to 0 disbales the
check, which is now the recommended way to get (terminating) code to
typecheck in releases. (The number of reduction steps may well change between
minor GHC releases!)

This commit also introduces a new IntWithInf type in BasicTypes
that represents an integer+infinity. This type is used in a few
places throughout the code.

Tests in
  typecheck/should_compile/T10184  (expected broken)
  typecheck/should_compile/T10185  (expected broken)

This commit also changes performance testsuite numbers, for the better.

4 years agoMake testsuite driver Python 2.6 compatible again
Thomas Miedema [Mon, 23 Mar 2015 12:56:22 +0000 (13:56 +0100)] 
Make testsuite driver Python 2.6 compatible again

Another bug in the #10164 series. Only Python 2.7 and up allow you to
omit the positional argument specifiers in format strings.

Test Plan: this fixes the Solaris builders

Reviewed By: kgardas

Differential Revision:

GHC Trac Issues: #10164

4 years agoUpdate base changelog regarding 4.8.1 changes
Herbert Valerio Riedel [Mon, 23 Mar 2015 10:19:50 +0000 (11:19 +0100)] 
Update base changelog regarding 4.8.1 changes

Turns out we've been a bit too lazy and quite a few undocumented changes have
accumulated in `base` relative to GHC 7.10's `base-`...

[skip ci]

4 years agoMinor bump `base` version to
Herbert Valerio Riedel [Mon, 23 Mar 2015 10:22:36 +0000 (11:22 +0100)] 
Minor bump `base` version to

We've accumulated enough to justify a minor version bump to,
but not enough to justify a major version bump yet as far as I can see.

4 years agoFix quasiquotation test (#4150)
Thomas Miedema [Mon, 23 Mar 2015 09:41:22 +0000 (10:41 +0100)] 
Fix quasiquotation test (#4150)

4 years agoMinor fix to Note [Trimming arity]
Joachim Breitner [Mon, 23 Mar 2015 09:12:34 +0000 (10:12 +0100)] 
Minor fix to Note [Trimming arity]

[ci skip]

4 years agoFix integer-gmp source tarball distribution
Herbert Valerio Riedel [Mon, 23 Mar 2015 07:11:32 +0000 (08:11 +0100)] 
Fix integer-gmp source tarball distribution

The `configure` script checks for presence of `install-sh` even if
it's not used, so we simply add it to the distribution to make `configure`

4 years agoUpdate integer-gmp2's changelog for release
Herbert Valerio Riedel [Fri, 20 Mar 2015 17:52:28 +0000 (18:52 +0100)] 
Update integer-gmp2's changelog for release

[skip ci]

(cherry picked from commit 7bd3efe3ccc6dc0a3ec84008285b4e03b48d8f41)

4 years agorts: check arguments to flags that don't have any
Carlos Tomé [Sun, 22 Mar 2015 23:53:42 +0000 (00:53 +0100)] 
rts: check arguments to flags that don't have any

There were some flags of the RTS that when given an argument (which they
don't have) were not firing an error.
e.g -Targument when the flag -T has no argument.
Now this is an error and affects the following flags:
-B -w -T -Z -P -Pa -c -t

Signed-off-by: Carlos Tomé <>
Reviewed By: austin, thomie, hvr

Differential Revision:

GHC Trac Issues: #9839

4 years agofix bus error (misaligned data access) on SPARC in __decodeDouble_Int64
Karel Gardas [Sun, 22 Mar 2015 20:58:03 +0000 (21:58 +0100)] 
fix bus error (misaligned data access) on SPARC in __decodeDouble_Int64

Reviewers: austin

Subscribers: thomie

Differential Revision:

4 years agodocs: make gen_contents_index --verbose more verbose
Austin Seipp [Sun, 22 Mar 2015 19:11:22 +0000 (14:11 -0500)] 
docs: make gen_contents_index --verbose more verbose

Signed-off-by: Austin Seipp <>
4 years agoTrim Call Arity
Joachim Breitner [Sat, 21 Mar 2015 14:58:38 +0000 (15:58 +0100)] 
Trim Call Arity

to not accidentially invalidate a strictness signature with a Diverges
result info. This seems to fix #10176.

Differential Revision:

4 years agoTest case for #10176
Joachim Breitner [Sat, 21 Mar 2015 14:08:16 +0000 (15:08 +0100)] 
Test case for #10176

originally provided by Neil Mitchell. Despite what he observed, I can
observe the bug even with all in one module.

4 years agoNew lint check: exprIsHNF = True and alts = [] is bogus
Joachim Breitner [Sat, 21 Mar 2015 14:02:07 +0000 (15:02 +0100)] 
New lint check: exprIsHNF = True and alts = [] is bogus

4 years agoClarify meaning of the RTS `taskCount` variable
Thomas Miedema [Sun, 22 Mar 2015 11:04:18 +0000 (12:04 +0100)] 
Clarify meaning of the RTS `taskCount` variable

In #9261, there was some confusion about the meaning of the taskCount
stats variable in the rts.

It turns out that taskCount is not decremented when a worker task is
stopped (i.e. from workerTaskStop), but only when freeMyTask is called,
which frees the task bound to the current thread. So taskCount is the
current number of bound tasks + the total number of worker tasks.

This makes the calculation of the current number of bound tasks in
rts/Stats.c correct _as is_.

[skip ci]

Reviewed By: austin

Differential Revision:

4 years agoUpdate haskeline submodule to release tag
Herbert Valerio Riedel [Sun, 22 Mar 2015 07:22:03 +0000 (08:22 +0100)] 
Update haskeline submodule to release tag

This fixes compilation under windows with pre-AMP GHCs
although it's not clear if bootstrapping GHC was affected.
(see for details)

4 years agotestsuite: add test for #10177
Austin Seipp [Sun, 22 Mar 2015 01:12:55 +0000 (20:12 -0500)] 
testsuite: add test for #10177

Signed-off-by: Austin Seipp <>
4 years agoCorrect documentation in `Parser`.
Matthew Pickering [Sat, 21 Mar 2015 11:57:18 +0000 (12:57 +0100)] 
Correct documentation in `Parser`.

Removed a trailing `in` from the final line which caused a compilation
error. [skip ci]

Reviewed by: thomie

Differential Revision:

4 years agoUpdate Cabal submodule to Cabal-v1.22.2.0 rls tag
Herbert Valerio Riedel [Sat, 21 Mar 2015 09:04:02 +0000 (10:04 +0100)] 
Update Cabal submodule to Cabal-v1.22.2.0 rls tag

this submdoule updates pulls in only meta-data changes

4 years agoUpdate bytestring submodule to release tag
Herbert Valerio Riedel [Fri, 20 Mar 2015 19:37:41 +0000 (20:37 +0100)] 
Update bytestring submodule to release tag

4 years agoTry to reconstruct a changelog for TH 2.10
Herbert Valerio Riedel [Fri, 20 Mar 2015 12:33:19 +0000 (13:33 +0100)] 
Try to reconstruct a changelog for TH 2.10

[skip ci]

(cherry picked from commit 9d15af88b9b5cbf9dd4a4d072aa94540074cc4b3)

4 years agoBump ghc-prim to
Herbert Valerio Riedel [Fri, 20 Mar 2015 11:23:41 +0000 (12:23 +0100)] 
Bump ghc-prim to

This major version bump was made necessary by
f44333eae7bc7dc7b6003b75874a02445f6b633b which changed the type
signatures of prefetch primops, as well as other changes
such as 051d694fc978ad28ac3043d296cafddd3c2a7050 turning `Any` into
an abstract closed type family.

Reviewed By: ekmett

Differential Revision:

4 years agoModify test th/T10019 to wobble less
Simon Peyton Jones [Thu, 19 Mar 2015 23:17:21 +0000 (23:17 +0000)] 
Modify test th/T10019 to wobble less

The TH output contains uniques which change too much.
So I took the length of the string instead. Crude,
perhaps too crude, but it'll still show up most significant
output changes