3 years agoDon't infer CallStacks
Eric Seidel [Mon, 4 Apr 2016 10:05:01 +0000 (12:05 +0200)] 
Don't infer CallStacks

We originally wanted CallStacks to be opt-in, but dealing with let
binders complicated things, forcing us to infer CallStacks. It turns
out that the inference is actually unnecessary though, we can let the
wanted CallStacks bubble up to the outer context by refusing to
quantify over them. Eventually they'll be solved from a given CallStack
or defaulted to the empty CallStack if they reach the top.

So this patch prevents GHC from quantifying over CallStacks, getting us
back to the original plan. There's a small ugliness to do with
PartialTypeSignatures, if the partial theta contains a CallStack
constraint, we *do* want to quantify over the CallStack; the user asked
us to!

Note that this means that

  foo :: _ => CallStack
  foo = getCallStack callStack

will be an *empty* CallStack, since we won't infer a CallStack for the
hole in the theta. I think this is the right move though, since we want
CallStacks to be opt-in. One can always write

  foo :: (HasCallStack, _) => CallStack
  foo = getCallStack callStack

to get the CallStack and still have GHC infer the rest of the theta.

Test Plan: ./validate

Reviewers: goldfire, simonpj, austin, hvr, bgamari

Reviewed By: simonpj, bgamari

Subscribers: bitemyapp, thomie

Projects: #ghc

Differential Revision:

GHC Trac Issues: #11573

3 years agoBump binary submodule
Ben Gamari [Mon, 4 Apr 2016 09:52:43 +0000 (11:52 +0200)] 
Bump binary submodule

3 years agoElaborate test for #11376
Simon Peyton Jones [Mon, 4 Apr 2016 09:34:35 +0000 (10:34 +0100)] 
Elaborate test for #11376

This just adds the Prox stuff from the Description in Trac #11376
to the test case,

The class stuff seems weird becuase the type is ambiguous

3 years agorts: Make StablePtr derefs thread-safe (#10296)
Jason Eisenberg [Mon, 4 Apr 2016 08:57:39 +0000 (10:57 +0200)] 
rts: Make StablePtr derefs thread-safe (#10296)

Stable pointers can now be safely dereferenced while the stable pointer
table is simultaneously being enlarged.

Test Plan: ./validate

Reviewers: ezyang, austin, bgamari, simonmar

Subscribers: carter, thomie

Differential Revision:

GHC Trac Issues: #10296

3 years agoDeeply instantiate in :type
Simon Peyton Jones [Mon, 4 Apr 2016 09:18:43 +0000 (10:18 +0100)] 
Deeply instantiate in :type

See Trac #11376 and
 Note [Deeply instantiate in :type] in TcRnDriver

Sadly this showed up one new problem (Trac #11786) and one opportunity
(Trac #11787), so test T11549 is now marked expect-broken on these two.

3 years agoImprove printing of pattern synonym types
Rik Steenkamp [Sat, 2 Apr 2016 19:39:10 +0000 (20:39 +0100)] 
Improve printing of pattern synonym types

Add the function `pprPatSynType :: PatSyn -> SDoc` for printing pattern
synonym types, and remove the ambiguous `patSynType` function. Also,
the types in a `PatSyn` are now tidy.

Haddock submodule updated to reflect the removal of `patSynType` by

Fixes: #11213.

Reviewers: goldfire, simonpj, austin, mpickering, bgamari

Reviewed By: simonpj, mpickering

Subscribers: bollmann, simonpj, thomie

Differential Revision:

GHC Trac Issues: #11213

3 years agoMake the example for -M work
Bartosz Nitka [Fri, 1 Apr 2016 20:03:17 +0000 (13:03 -0700)] 
Make the example for -M work

`ghc` fails without `-dep-suffix ''`.

Test Plan: visual inspection

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, simonmar

Differential Revision:

3 years agoRevert "Demand Analyzer: Do not set OneShot information"
Joachim Breitner [Thu, 31 Mar 2016 16:29:50 +0000 (18:29 +0200)] 
Revert "Demand Analyzer: Do not set OneShot information"

This reverts commit 28fe0eea4d161b707f67aae26fddaa2e60d8a901 due to
various regressions. I’m not sure why my local
./validate --slow
run did not catch this, though.

3 years agoRevert accidental change to collectTyAndValBinders
Simon Peyton Jones [Thu, 31 Mar 2016 09:47:47 +0000 (10:47 +0100)] 
Revert accidental change to collectTyAndValBinders

Richard accidetally introduced this change in his big kind-equality
patch.  The code is wrong, and potentially could cause binders to
be re-ordered.

Worth merging to 8.0.

3 years agoDemand Analyzer: Do not set OneShot information
Joachim Breitner [Wed, 30 Mar 2016 08:05:28 +0000 (10:05 +0200)] 
Demand Analyzer: Do not set OneShot information

as suggested in ticket:11770#comment:1. This code was buggy (#11770),
and the occurrence analyzer does the same job anyways.

This also elaborates the notes in the occurrence analyzer accordingly.

Differential Revision:

3 years agoRefactor error generation for pattern synonyms
Simon Peyton Jones [Wed, 30 Mar 2016 16:31:59 +0000 (17:31 +0100)] 
Refactor error generation for pattern synonyms

The result of a series of patches on type-error messages for
pattern synonyms had become a bit baroque. This tidies it up
a bit.  Still not fantastic, but better.

3 years agoMake SigSkol take TcType not ExpType
Simon Peyton Jones [Wed, 30 Mar 2016 16:23:37 +0000 (17:23 +0100)] 
Make SigSkol take TcType not ExpType

For some reason a SigSkol had an ExpType in it, and there were
lots of places where we needed it to have a TcType.  And was indeed
always a Check.  All a lot of fuss about nothing.

Delete code, fewer failure points, types are more precise.
All good.

3 years agoSmall refactor of TcMType.tauifyExpType
Simon Peyton Jones [Wed, 30 Mar 2016 16:19:51 +0000 (17:19 +0100)] 
Small refactor of TcMType.tauifyExpType

Mainly to make it clearer that tauifyExpType
is a no-op on (Check ty)

3 years agoRefactor in TcMatches
Simon Peyton Jones [Wed, 30 Mar 2016 16:14:11 +0000 (17:14 +0100)] 
Refactor in TcMatches

* Move the several calls of tauifyMultipleMatches into tcMatches,
  so that it can be called only once, and the invariants are

* I discovered in doing this that HsLamCase had a redundant and
  tiresome argument, so I removed it. That in turn allowed some
  modest but nice code simplification

3 years agoComments only
Simon Peyton Jones [Wed, 30 Mar 2016 16:09:10 +0000 (17:09 +0100)] 
Comments only

3 years agoMinor refactoring in mkExport
Simon Peyton Jones [Tue, 29 Mar 2016 08:57:29 +0000 (09:57 +0100)] 
Minor refactoring in mkExport

No change in behaviour

3 years agoComments only
Simon Peyton Jones [Tue, 29 Mar 2016 08:57:06 +0000 (09:57 +0100)] 
Comments only

3 years agoKill the magic of Any
Ben Gamari [Wed, 30 Mar 2016 19:58:24 +0000 (21:58 +0200)] 
Kill the magic of Any

This turns `Any` into a standard wired-in type family defined in
`GHC.Types`, instead its current incarnation as a magical creature
provided by the `GHC.Prim`.  Also kill `AnyK`.

See #10886.

Test Plan: Validate

Reviewers: simonpj, goldfire, austin, hvr

Reviewed By: simonpj

Subscribers: goldfire, thomie

Differential Revision:

GHC Trac Issues: #10886

3 years agoAdd -f(no-)version-macro to explicitly control macros.
Edward Z. Yang [Wed, 30 Mar 2016 19:44:09 +0000 (21:44 +0200)] 
Add -f(no-)version-macro to explicitly control macros.

Test Plan: validate

Reviewers: thomie, austin, bgamari

Reviewed By: bgamari

Subscribers: hvr

Differential Revision:

GHC Trac Issues: #11763

3 years agoDon't require -hide-all-packages for MIN_VERSION_* macros
Thomas Miedema [Wed, 30 Mar 2016 19:43:51 +0000 (21:43 +0200)] 
Don't require -hide-all-packages for MIN_VERSION_* macros

Define MIN_VERSION_pkgname and VERSION_pkgname macros for all exposed
packages, without requiring -hide-all-packages.

See #10970 comment 7-10 for discussion.

Reviewers: duncan, ezyang, bgamari, austin

Reviewed By: ezyang

Subscribers: hvr, rwbarton

Differential Revision:

GHC Trac Issues: #10970

3 years agoghc-prim: Mark unpackCStringUtf8# and unpackNBytes# as NOINLINE
Ben Gamari [Wed, 30 Mar 2016 08:29:02 +0000 (10:29 +0200)] 
ghc-prim: Mark unpackCStringUtf8# and unpackNBytes# as NOINLINE

There is no benefit to be had from inlining this function and it may
defeat rewrite rules if inlined early. See #11772..

Test Plan: Validate, nofib

Reviewers: simonpj, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11772

3 years agoDefer inlining of Ord methods
Ben Gamari [Wed, 30 Mar 2016 08:46:39 +0000 (10:46 +0200)] 
Defer inlining of Ord methods

This performs the same refactoring performed in D1980 for Eq on Ord,
rewriting the class operations in terms of monomorphic helpers than can
be reliably matched in rewrite rules.

3 years agoghc-prim: Delay inlining of {gt,ge,lt,le}Int to phase 1
Ben Gamari [Wed, 30 Mar 2016 08:09:36 +0000 (10:09 +0200)] 
ghc-prim: Delay inlining of {gt,ge,lt,le}Int to phase 1

Otherwise rewrite rules may not get an opporunity to fire.

3 years agorts/posix/Itimer.c: Handle EINTR when reading timerfd
Erik de Castro Lopo [Mon, 28 Mar 2016 03:29:37 +0000 (14:29 +1100)] 
rts/posix/Itimer.c: Handle EINTR when reading timerfd

Commit 8626d76a72 added checking of the return value when reading from
the `timer_fd` and calling `sysErrorBelch` to print a warning message.
However some error causes (like EINTR) are benign and should just be

Test Plan: validate

Reviewers: hvr, austin, bgamari

Subscribers: thomie

Differential Revision:

3 years agoComments only in Unify.hs
Simon Peyton Jones [Wed, 30 Mar 2016 16:43:14 +0000 (17:43 +0100)] 
Comments only in Unify.hs

To clarify what the "pure unifier" does, compared to the
"impure unifiers" in the type checker.

3 years agoDo not claim that -O2 does not do better than -O
Joachim Breitner [Wed, 30 Mar 2016 14:09:36 +0000 (16:09 +0200)] 
Do not claim that -O2 does not do better than -O

when in fact it does. This was pointed out by Johannes Bechberger and
supported with seemingly statistically sound evidence in his Bachelor
thesis: Of the benchmark shootout programs, 80% benefit significantly by
switchtng from -O to -O2.

for a few raw numbers.

Differential Revision:

3 years agoDon't recompute some free vars in lintCoercion
Bartosz Nitka [Wed, 30 Mar 2016 02:37:54 +0000 (19:37 -0700)] 
Don't recompute some free vars in lintCoercion

As pointed out by @simonpj on D2044 we don't need
to compute the free vars of the range of the substitution
as most of them are already carried by the monad.
This should be a tiny performance improvement over the version
from before D2044.

Also removes an extra function that is now unnecessary.

Test Plan: ./validate && ./validate --slow

Reviewers: goldfire, simonpj, austin, bgamari

Reviewed By: simonpj

Subscribers: thomie, simonmar, simonpj

Differential Revision:

GHC Trac Issues: #11371

3 years agoTypos in non-code
Gabor Greif [Wed, 30 Mar 2016 09:04:37 +0000 (11:04 +0200)] 
Typos in non-code

3 years agoAdd testcase for #11770
Joachim Breitner [Wed, 30 Mar 2016 07:59:09 +0000 (09:59 +0200)] 
Add testcase for #11770

and use normalise_errmsg_fun to check the core output in all.T, instead
relying on code in the Makefile.

3 years agobase: Fix haddock typo
Ben Gamari [Tue, 29 Mar 2016 16:59:57 +0000 (18:59 +0200)] 
base: Fix haddock typo

3 years agousers-guide/rel-notes: Note broken-ness of ImpredicativeTypes
Ben Gamari [Tue, 29 Mar 2016 14:30:29 +0000 (16:30 +0200)] 
users-guide/rel-notes: Note broken-ness of ImpredicativeTypes

3 years agorename: Disallow type signatures in patterns in plain Haskell
Ben Gamari [Tue, 29 Mar 2016 12:11:57 +0000 (14:11 +0200)] 
rename: Disallow type signatures in patterns in plain Haskell

This should require -XScopedTypeVariables. It seems this was previously
handled by RnTypes.rnHsBndrSig which called RnTypes.badKindSigErr but
this was broken in Simon's refactor of wildcards,
1e041b7382b6aa329e4ad9625439f811e0f27232. Here we re-introduce a check
in RnPat. See #11663.

Test Plan: Validate with `T11663`

Reviewers: austin, simonpj

Reviewed By: austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11663

3 years agoTes suite output updates
Joachim Breitner [Tue, 29 Mar 2016 14:47:53 +0000 (16:47 +0200)] 
Tes suite output updates

3 years agoDo not print DmdType in Core output
Joachim Breitner [Wed, 23 Mar 2016 12:38:34 +0000 (13:38 +0100)] 
Do not print DmdType in Core output

too verbose, and usualy preceded by Str= anyways.

3 years agoRename isNopSig to isTopSig
Joachim Breitner [Wed, 23 Mar 2016 09:41:16 +0000 (10:41 +0100)] 
Rename isNopSig to isTopSig

to be consistent with the other uses of nop vs. top in Demand.hs. Also,
stop prettyprinting top strictness signatures in Core dumps.

3 years agoSpecConstr: Transport strictness data to specialization’s argument’s binders
Joachim Breitner [Tue, 22 Mar 2016 14:39:06 +0000 (15:39 +0100)] 
SpecConstr: Transport strictness data to specialization’s argument’s binders

This is a result of the discussion in ticket:11731#comment:9.

3 years agoTypo in Note name
Joachim Breitner [Tue, 22 Mar 2016 10:14:08 +0000 (11:14 +0100)] 
Typo in Note name

3 years agoTicky: Do not count every entry twice
Joachim Breitner [Thu, 17 Mar 2016 16:25:36 +0000 (17:25 +0100)] 
Ticky: Do not count every entry twice

(likely introduced by 99d4e5b4a0bd32813ff8c74e91d2dcf6b3555176, possibly
due to a merge mistake).

3 years agoBe more explicit about closure types in ticky-ticky-report
Joachim Breitner [Thu, 17 Mar 2016 15:33:18 +0000 (16:33 +0100)] 
Be more explicit about closure types in ticky-ticky-report

The report now distinguishes thunks (in the variants single-entry and
standard thunks), constructors and functions (possibly single-entry).

Forthermore, for standard thunks (AP and selector), do not count an
entry when they are allocated. It is not possible to count their
entries, as their code is shared, but better count nothing than count
the wrong thing.

3 years agoRemove all mentions of IND_OLDGEN outside of docs/rts
Joachim Breitner [Fri, 22 Jan 2016 09:31:25 +0000 (10:31 +0100)] 
Remove all mentions of IND_OLDGEN outside of docs/rts

3 years agocleanup POSIX/XOPEN defines for switch to C99
Karel Gardas [Tue, 29 Mar 2016 10:21:54 +0000 (12:21 +0200)] 
cleanup POSIX/XOPEN defines for switch to C99

This patch cleans up various POSIX and XOPEN defines.
We aim to switch to C99 solely and for this the lowest version
of supported POSIX/XOPEN is:

Test Plan:
tested on Solaris 11 and OpenBSD 5.9. Should be good
also on Solaris 10, FreeBSD and DragonFlyBSD. We need to test
on Mac OS X, Linux and MinGW

Reviewers: austin, bgamari, erikd, hvr

Subscribers: thomie

Differential Revision:

3 years agobase: Add comment noting import loop
Ben Gamari [Tue, 29 Mar 2016 11:34:45 +0000 (13:34 +0200)] 
base: Add comment noting import loop

3 years agoAdd Data.Functor.Classes instances for Proxy (trac issue #11756)
Andrew Martin [Tue, 29 Mar 2016 08:57:47 +0000 (10:57 +0200)] 
Add Data.Functor.Classes instances for Proxy (trac issue #11756)

Test Plan: currently no test plan

Reviewers: hvr, RyanGlScott, bgamari, austin

Reviewed By: RyanGlScott, bgamari, austin

Subscribers: thomie, RyanGlScott, andrewthad

Differential Revision:

GHC Trac Issues: #11756

3 years agoUse the correct substitution in lintCoercion
Bartosz Nitka [Tue, 29 Mar 2016 10:42:32 +0000 (12:42 +0200)] 
Use the correct substitution in lintCoercion

We need the free vars of `t2` to satisfy the substitution
invariant. Luckily they are in the in-scope carried around.

Test Plan: ./validate

Reviewers: bgamari, austin, goldfire, simonpj

Reviewed By: simonpj

Subscribers: thomie, simonmar

Differential Revision:

GHC Trac Issues: #11371

3 years agoBuild correct substitution in instDFunType
Bartosz Nitka [Tue, 29 Mar 2016 10:42:16 +0000 (12:42 +0200)] 
Build correct substitution in instDFunType

We will use `ty` in the range of the substitution, hence
the substitution needs `ty`'s free vars in-scope.
They don't seem easily available by other means, so we
just compute them.

Test Plan: ./validate

Reviewers: austin, goldfire, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie, simonmar

Differential Revision:

GHC Trac Issues: #11371

3 years agoUse a correct substitution in tcInstType
Bartosz Nitka [Tue, 29 Mar 2016 10:41:59 +0000 (12:41 +0200)] 
Use a correct substitution in tcInstType

`ty` doesn't have to be a closed type, so we need to add its
free vars to the in-scope set. They don't seem to be
available anywhere nearby, so we have to compute them.

Test Plan: ./validate

Reviewers: goldfire, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie, simonmar

Differential Revision:

GHC Trac Issues: #11371

3 years agousers-guide: Add references to various issues in bugs section
Ben Gamari [Tue, 29 Mar 2016 08:58:04 +0000 (10:58 +0200)] 
users-guide: Add references to various issues in bugs section

Test Plan: Read it

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #7411, #11197, #11554, #11715

3 years agousers-guide: Wibbles
Ben Gamari [Mon, 28 Mar 2016 13:40:34 +0000 (15:40 +0200)] 
users-guide: Wibbles

3 years agousers-guide: Provide more depth in table-of-contents
Ben Gamari [Mon, 28 Mar 2016 12:57:56 +0000 (14:57 +0200)] 
users-guide: Provide more depth in table-of-contents

Per Simon's request.

3 years agobase: Document caveats about Control.Concurrent.Chan
Erik de Castro Lopo [Mon, 28 Mar 2016 12:52:35 +0000 (14:52 +0200)] 
base: Document caveats about Control.Concurrent.Chan

These are implemented using `MVars` which have known caveats. Suggest
the use of `TChan` from the stm library instead.

Test Plan: n/a

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

3 years agoReenable external-json linters
Ben Gamari [Mon, 28 Mar 2016 12:51:24 +0000 (14:51 +0200)] 
Reenable external-json linters

This is to be merged once a fix for the Harbormaster build script has
been applied.

This reverts commit a14296c2660521db8ba965065687e45cee4e3401. These were
previously disabled due to Harbormaster validation failures.

Also, apply CPP check to .c and .h files in addition to Haskell sources.

Test Plan: Let Harbormaster validate

Reviewers: austin

Reviewed By: austin

Subscribers: hvr, thomie

Differential Revision:

3 years agofix compilation failure on Solaris 11
Karel Gardas [Mon, 28 Mar 2016 22:06:48 +0000 (00:06 +0200)] 
fix compilation failure on Solaris 11

Solaris is quite picky about C and POSIX version combination.
For recent change to C99 we need to switch _XPG6 on which means
_XOPEN_SOURCE should be defined to 600

Reviewers: austin, bgamari, erikd

Subscribers: thomie

Differential Revision:

3 years agoRemove obsolete --with-hc flag from ./configure
Herbert Valerio Riedel [Mon, 28 Mar 2016 21:20:10 +0000 (23:20 +0200)] 
Remove obsolete --with-hc flag from ./configure

This was probably missed during the big build-system refactoring in

3 years agoUpdate bytestring submodule to latest snapshot
Herbert Valerio Riedel [Mon, 28 Mar 2016 15:28:49 +0000 (17:28 +0200)] 
Update bytestring submodule to latest snapshot

Most notably, this pulls in the following changes

> Fix breakByte and spanByte rewrite rules
> Implement `stripPrefix`/`stripSuffix`

The first patch is related to #11688

3 years agoDo not test for existence of the executable
Kai Harries [Mon, 28 Mar 2016 13:18:05 +0000 (15:18 +0200)] 
Do not test for existence of the executable

The test for the existence of the executable breaks on MS Windows. It is
furthermore needless, because if the test can be executed the executable
is obviously there.

Reviewers: austin, bgamari, Phyx

Reviewed By: Phyx

Subscribers: Phyx, thomie

Differential Revision:

GHC Trac Issues: #4114

3 years agoAutoconf: detect and set CFLAGS/CPPFLAGS needed for C99 mode
Herbert Valerio Riedel [Mon, 28 Mar 2016 12:34:22 +0000 (14:34 +0200)] 
Autoconf: detect and set CFLAGS/CPPFLAGS needed for C99 mode

This is the first phase of addressing #11757 which aims to make C99
support a base-line requirement for GHC and clean up the code-base to
use C99 facilities when sensible.

This patch exploits the logic/heuristic used by `AC_PROG_CC_C99` to
determine the flags needed in case the C compiler isn't able to compile
C99 code in its current mode. We can't use `AC_PROG_CC_C99` directly
though because GHC's build-system expects CC to contain a filename
without any flags, while `AC_PROG_CC_C99` would e.g. result in
`CC="gcc -std=gnu99"`. Morever, we support different `CC`s for
stage0/1/2, so we need a version of `AC_PROG_CC_C99` for which we can
specify the `CC`/`CFLAGS` variables to operate on. This is what
`FP_SET_CFLAGS_C99` does.

Note that Clang has been defaulting to C99+ for a long time, while GCC 5
defaults to C99+ as well. So this has mostly an affect on older GCCs
versions prior to 5.0 and possibly compilers other than GCC/Clang (which
are not officially supported for building GHC anyway).

Reviewers: kgardas, erikd, bgamari, austin

Reviewed By: erikd

Differential Revision:

3 years agoDrop Xcode 4.1 hack and fix ignored CC var issue
Herbert Valerio Riedel [Mon, 28 Mar 2016 10:55:21 +0000 (12:55 +0200)] 
Drop Xcode 4.1 hack and fix ignored CC var issue

Xcode 4.1 was released back in 2011 for Mac OSX 10.6/10.7.
However, OSX 10.7 reached EOL sometime around the end of 2014.
So this `--with-gcc-4.2` hack shouldn't be needed anymore.

Moreover, this patch changes ./configure to honor the CC env-var
again (and thus fix #11231) while giving `--with-gcc=...` a higher
priority over `CC=...`.

So the following 3 invocations are equivalent now:

  CC=... ./configure
  ./configure CC=...
  ./configure --with-gcc=...

Since `--with-{gcc,clang}=...` is a misnomer (as is made apparent by
`--with-gcc=clang` or `--with-clang=gcc`), this would give us a neutral
and idiomatic way to tell ./configure which C compiler to use.

Moreover, `./configure --help` says at the end of its output:

  Some influential environment variables:
    CC C compiler command
    CFLAGS C compiler flags
    LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
    LIBS libraries to pass to the linker, e.g. -l<library>
    CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
    CPP C preprocessor

  Use these variables to override the choices made by `configure' or to help
  it to find libraries and programs with nonstandard names/locations.

Consequently, by honoring CC=... (rather than ignoring it) we increase
consistency and reduce user confusion. Ideally, CC=... would become the
recommended way to set the C compiler, and `--with-{clang,gcc}=...`
would be demoted to legacy aliases.

Reviewed By: erikd, bgamari

Differential Revision:

3 years agoScrap DEC OSF/1 support
Herbert Valerio Riedel [Mon, 28 Mar 2016 10:24:37 +0000 (12:24 +0200)] 
Scrap DEC OSF/1 support

DEC OSF/1 (aka Tru64 UNIX) has been discontinued a few years ago already[1].

This removes the undoubtedly bitrotten support for `OSOsf3 :: OS` from GHC's

Support for `ArchAlpha :: Arch` may be removed at some later point, as there
may still be users out there running a more or less recent Linux/alpha
distribution on their more-than-a-decade old Alpha hardware...


3 years agoScrap IRIX support
Herbert Valerio Riedel [Mon, 28 Mar 2016 09:36:21 +0000 (11:36 +0200)] 
Scrap IRIX support

Long time ago, IRIX was way ahead of its time in the last century with
its SMP capabilities of scaling up to 1024 processors and other features
such as XFS or OpenGL that originated in IRIX and live on to this day in
other operating systems.

However, IRIX's last software update was in 2006 and support ended
around 2013 according to [1], so it's considered an extinct platform by
now. So this commit message is effectively an obituary for GHC's IRIX



3 years agoFix AIX/ppc codegen in `-prof` compilation mode
Herbert Valerio Riedel [Sun, 27 Mar 2016 21:41:12 +0000 (23:41 +0200)] 
Fix AIX/ppc codegen in `-prof` compilation mode

The implementation in df26b95559fd467abc0a3a4151127c95cb5011b9
wrongly assumed that all C-ABI subroutine calls would use a
'ForeignLabel' but it turns out that calls inserted via
'emitRtsCall' use 'CmmLabel's instead.

3 years agoRemove now pointless INLINE_ME macro
Herbert Valerio Riedel [Sun, 27 Mar 2016 19:43:44 +0000 (21:43 +0200)] 
Remove now pointless INLINE_ME macro

At some point there may have been a reason for the
`INLINE_ME` macro, but not anymore...

Reviewed By: austin

Differential Revision:

3 years agoRemove now obsolete LD_STAGE0 hack
Herbert Valerio Riedel [Sun, 27 Mar 2016 18:03:33 +0000 (20:03 +0200)] 
Remove now obsolete LD_STAGE0 hack

This was introduced in 109a1e53287f50103e8a5b592275940b6e3dbb53
but isn't needed anymore because by now we're bootstrapping with
GHC versions which already provide "ld command" in `ghc --info`
(that field was added in GHC 7.8)

3 years agoClarify Note [Kind coercions in Unify]
Richard Eisenberg [Fri, 25 Mar 2016 21:25:25 +0000 (17:25 -0400)] 
Clarify Note [Kind coercions in Unify]

3 years agoCheck for rep poly on wildcard binders.
Richard Eisenberg [Fri, 25 Mar 2016 20:18:09 +0000 (16:18 -0400)] 
Check for rep poly on wildcard binders.

I had just missed this case when adding my test.
This is relevant to ticket #11473.

Also adds lots of comments.

3 years agoFix #11754 by adding an additional check.
Richard Eisenberg [Fri, 25 Mar 2016 19:11:24 +0000 (15:11 -0400)] 
Fix #11754 by adding an additional check.

This was just plain wrong previously.

Test case: typecheck/should_compile/T11754

3 years agoRTS: Fix & refactor "portable inline" macros
Herbert Valerio Riedel [Fri, 25 Mar 2016 23:59:31 +0000 (00:59 +0100)] 
RTS: Fix & refactor "portable inline" macros

Turns out the current macros for gnu90-style inline
semantics stopped working with GCC 5
(and possibly also with Apple's GCC) which switched on
`__GNUC_STDC_INLINE__` by default falling back to using the
suboptimal `static inline` mode.

However, C99 supports an equivalent (as far as our
use-case is concerned) `extern inline` mode.

See also
for a write-up of gnu90 vs C99 semantics.

This patch also removes the MSVC case as VS2015 is supposed
to finally catch up to C99 (and C11), so we don't need any
special care for MSVC anymore.

Reviewed By: erikd, austin

Differential Revision:

3 years agoDWARF: Add debugging information chapter to users guide
Ben Gamari [Fri, 25 Mar 2016 23:44:21 +0000 (00:44 +0100)] 
DWARF: Add debugging information chapter to users guide

Test Plan: Proof-read

Reviewers: scpmw, austin

Subscribers: simonmar, thomie

Differential Revision:

3 years agotestsuite: Identify framework failures in testsuite summary
Ben Gamari [Fri, 25 Mar 2016 23:43:24 +0000 (00:43 +0100)] 
testsuite: Identify framework failures in testsuite summary

Currently the testsuite driver tells you how many tests failed due to a
framework failure but you need to manually grep through the testsuite
output to identify which ones.

Test Plan: Validate with, e.g., a timing out testcase

Reviewers: austin, thomie

Reviewed By: austin, thomie

Differential Revision:

GHC Trac Issues: #11165

3 years agoPanic: Try outputting SDocs
Ben Gamari [Fri, 25 Mar 2016 23:42:27 +0000 (00:42 +0100)] 
Panic: Try outputting SDocs

This works in conjunction with D2036 to allow useful debug output before
DynFlags has been initializated.

See #11755.

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, gridaphobe

Differential Revision:

GHC Trac Issues: #11755

3 years agoDynFlags: Initialize unsafeGlobalDynFlags enough to be useful
Ben Gamari [Fri, 25 Mar 2016 23:42:11 +0000 (00:42 +0100)] 
DynFlags: Initialize unsafeGlobalDynFlags enough to be useful

Previously unsafeGlobalDynFlags would bottom if used prior to
initialization. This meant that any attempt to use the pretty-printer
early in the initialization process of the compiler would fail. This is
quite inconvenient.

Here we initialize unsafeGlobalDynFlags with defaultDynFlags, bottoming
only if settings is accessed.

See #11755.

Test Plan: Validate

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, gridaphobe

Differential Revision:

GHC Trac Issues: #11755

3 years agoMore clarification in docs for implicit quantification
Simon Peyton Jones [Fri, 25 Mar 2016 10:41:57 +0000 (10:41 +0000)] 
More clarification in docs for implicit quantification

This is a follow-up patch to the previous one for #11726.
It turns out that I'd missed the point of the ticket; this
patch addresses it.

3 years agoDocument implicit quantification better
Simon Peyton Jones [Fri, 25 Mar 2016 10:32:13 +0000 (10:32 +0000)] 
Document implicit quantification better

Addresses Trac #11726

3 years agoTest Trac #11728
Simon Peyton Jones [Fri, 25 Mar 2016 10:22:07 +0000 (10:22 +0000)] 
Test Trac #11728

3 years agoA raft of comments about TyBinders
Simon Peyton Jones [Fri, 25 Mar 2016 09:28:31 +0000 (09:28 +0000)] 
A raft of comments about TyBinders

I had a conversation with Richard about TyBinders
and VisibilityFlags.  This patch adds a lot of comments
to explain what is going on.  I feel much more secure now.

Richard please check.

3 years agoCorePrep: refactoring to reduce duplication
Simon Peyton Jones [Fri, 25 Mar 2016 09:25:34 +0000 (09:25 +0000)] 
CorePrep: refactoring to reduce duplication

There's no functional change here, just tidying up

3 years agoDo not eta-reduce across Ticks in CorePrep
Simon Peyton Jones [Fri, 25 Mar 2016 09:23:17 +0000 (09:23 +0000)] 
Do not eta-reduce across Ticks in CorePrep

The function tryEtaReducePrep was being over-ambitious.
When Breakpoint ticks were involved (i.e. in GHCi), eta
reduction left an out-of-scope variable in the Tick.

Easily fixed. Fixes the original report in Trac #111728.

3 years agoAn extra traceTc in tcExpr for ExprWithSig
Simon Peyton Jones [Thu, 24 Mar 2016 20:53:14 +0000 (20:53 +0000)] 
An extra traceTc in tcExpr for ExprWithSig

3 years agobase: Fix GHC.Word and GHC.Int on 32-bit platforms
Ben Gamari [Thu, 24 Mar 2016 23:48:22 +0000 (00:48 +0100)] 
base: Fix GHC.Word and GHC.Int on 32-bit platforms

Due to a cut-and-paste error D1980 (#11688) broke 32-bit platforms. This
should fix it.

See #11750.

3 years agoRemove code-duplication in the PPC NCG
Herbert Valerio Riedel [Thu, 24 Mar 2016 22:24:08 +0000 (23:24 +0100)] 
Remove code-duplication in the PPC NCG

Reviewed By: bgamari, trommler

Differential Revision:

3 years agoAdd NCG support for AIX/ppc32
Herbert Valerio Riedel [Thu, 24 Mar 2016 20:00:17 +0000 (21:00 +0100)] 
Add NCG support for AIX/ppc32

This extends the previous work to revive the unregisterised GHC build
for AIX/ppc32. Strictly speaking, AIX runs on POWER4 (and later)
hardware, but the PPC32 instructions implemented in the PPC NCG
represent a compatible subset of the POWER4 ISA.

IBM AIX follows the PowerOpen ABI (and shares many similiarites with the
Linux PPC64 ELF V1 NCG backend) but uses the rather limited XCOFF
format (compared to ELF).

This doesn't support dynamic libraries yet.

A major limiting factor is that the AIX assembler does not support the
`@ha`/`@l` relocation types nor the ha16()/lo16() functions Darwin's
assembler supports. Therefore we need to avoid emitting those. In case
of numeric literals we simply compute the functions ourselves, while for
labels we have to use local TOCs and hope everything fits into a 16bit
offset (for ppc32 this gives us at most 16384 entries per TOC section,
which is enough to compile GHC).

Another issue is that XCOFF doesn't seem to have a relocation type for
label-differences, and therefore the label-differences placed into
tables-next-to-code can't be relocated, but the linker may rearrange
different sections, so we need to place all read-only sections into the
same `.text[PR]` section to workaround this.

Finally, the PowerOpen ABI distinguishes between function-descriptors
and actualy entry-point addresses. For AIX we need to be specific when
emitting assembler code whether we want the address of the function
descriptor `printf`) or for the entry-point (`.printf`). So we let the
asm pretty-printer prefix a dot to all emitted subroutine
calls (i.e. `BL`) on AIX only. For now, STG routines' entry-point labels
are not prefixed by a label and don't have any associated

Reviewers: austin, trommler, erikd, bgamari

Reviewed By: trommler, erikd, bgamari

Differential Revision:

3 years agoAdd option `no-keep-hi-files` and `no-keep-o-files` (fixes #4114)
Kai Harries [Thu, 24 Mar 2016 21:33:27 +0000 (22:33 +0100)] 
Add option `no-keep-hi-files` and `no-keep-o-files` (fixes #4114)

Summary: Remove `.hi` and `.o` files if the flags `no-keep-hi-files` and
`no-keep-o-files` are given.

Test Plan: ./validate

Reviewers: austin, thomie, bgamari

Reviewed By: thomie, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4114

3 years agousers_guide: small improvements on pattern synonyms.
Dominik Bollmann [Thu, 24 Mar 2016 21:32:56 +0000 (22:32 +0100)] 
users_guide: small improvements on pattern synonyms.

Since the order of required and provided constraint contexts of pattern
synonyms has been switched recently, I updated a couple places in the
users guide's pattern synonym section to accommodate for this.

Test Plan: read it :-)

Reviewers: goldfire, thomie, mpickering, simonpj, austin, bgamari

Reviewed By: bgamari

Differential Revision:

3 years agousers-guide: Add -Wredundant-constraints to flags reference
Ben Gamari [Thu, 24 Mar 2016 21:32:20 +0000 (22:32 +0100)] 
users-guide: Add -Wredundant-constraints to flags reference

Test Plan: Validate and read

Reviewers: austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11741

3 years agousers_guide: Fix various issues
Ben Gamari [Thu, 24 Mar 2016 21:32:04 +0000 (22:32 +0100)] 
users_guide: Fix various issues

Sphinx apparently expects references to anchors that don't accompany a
header to have a caption.

Test Plan: validate

Reviewers: austin

Subscribers: thomie

Differential Revision:

3 years agoAvoid local label syntax for assembler on AIX
Herbert Valerio Riedel [Thu, 24 Mar 2016 19:35:42 +0000 (20:35 +0100)] 
Avoid local label syntax for assembler on AIX

Unfortunately (for inline `__asm__()` uses), IBM's `as` doesn't seem to support
local labels[1] like GNU `as` does so we need to workaround this when on AIX.


Turns out this also addresses the long-standing bug #485

Reviewed By: bgamari, trommler

Differential Revision:

3 years agoTidy up handling of coercion variables
Simon Peyton Jones [Thu, 24 Mar 2016 17:31:12 +0000 (17:31 +0000)] 
Tidy up handling of coercion variables

* Comments to explain that a CoVar, whose IdInfo is CoVarId,
  is always unlifted (but may be nominal or representational role)

  And TyCoRep.isCoercionType picks out only those unlifted
  types, NOT the lifted versions

* Introduce Var.NcId for non-co-var Ids
  with predicate isNonCoVarId

* Add assertions in CoreSubst that the Id env is only
  used for NcIds

* Fix lurking bug in CSE which extended the
  CoreSubst Id env with a CoVar

* Fix two bugs in Specialise.spec_call, which wrongly treated
  CoVars like NcIds
    - needed a varToCoreExpr in one place
    - needed extendSubst not extendIdSubst in another
  This was the root cause of Trac #11644

Minor refactoring

* Eliminate unused mkDerivedLocalCoVarM, mkUserLocalCoVar
* Small refactor in mkSysLocalOrCoVar

3 years agoComments only
Simon Peyton Jones [Thu, 24 Mar 2016 17:21:56 +0000 (17:21 +0000)] 
Comments only

3 years agoDefer inlining of Eq for primitive types
Ben Gamari [Thu, 24 Mar 2016 10:24:32 +0000 (11:24 +0100)] 
Defer inlining of Eq for primitive types

This is one solution to #11688, wherein (==) was inlined to soon
defeating a rewrite rule provided by bytestring. Since the RHSs of Eq's
methods are simple, there is little to be gained and much to be lost by
inlining them early.

For instance, the bytestring library provides,

break :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString)
breakByte :: Word8 -> ByteString -> (ByteString, ByteString)

and a rule

forall x. break ((==) x) = breakByte x

since `breakByte` implments an optimized version of `break (== x)` for
known `x :: Word8`. If we allow `(==)` to be inlined too early, we will
prevent this rule from firing. This was the cause of #11688.

This patch just defers the `Eq` methods, although it's likely worthwhile
giving `Ord` this same treatment. This regresses compiler allocations
for T9661 by about 8% due to the additional inlining that we now require
the simplifier to perform.

Updates the `bytestring` submodule to include updated rewrite rules
which match on `eqWord8` instead of `(==)`.

Test Plan:
 * Validate, examine performance impact

Reviewers: simonpj, hvr, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11688

3 years agoDefault RuntimeRep variables unless -fprint-explicit-runtime-reps
Ben Gamari [Thu, 24 Mar 2016 10:39:59 +0000 (11:39 +0100)] 
Default RuntimeRep variables unless -fprint-explicit-runtime-reps

Addresses #11549 by defaulting `RuntimeRep` variables to `PtrRepLifted`
and adding a new compiler flag `-fprint-explicit-runtime-reps` to
disable this behavior.

This is just a guess at the right way to go about this. If it's
wrong-beyond-any-hope just say so.

Test Plan: Working on a testcase

Reviewers: goldfire, austin

Subscribers: simonpj, thomie

Differential Revision:

GHC Trac Issues: #11549

3 years agoShow: Restore redundant parentheses around records
Ben Gamari [Thu, 24 Mar 2016 09:54:11 +0000 (10:54 +0100)] 
Show: Restore redundant parentheses around records

As discussed in #2530 we are going to continue to produce parentheses
here in order to preserve compatibility with previous GHC releases. It
was found that dropped parentheses would break some testsuites which
compared against output from Show. This has been documented in the users

This reverts commit 5692643c9d17e746327588cd6157a923642b7975.

Test Plan: Validate

Reviewers: hvr, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #2350

3 years agoRevert "Various ticky-related work"
Ben Gamari [Thu, 24 Mar 2016 10:23:31 +0000 (11:23 +0100)] 
Revert "Various ticky-related work"

This reverts commit 6c2c853b11fe25c106469da7b105e2be596c17de which was
supposed to be merged as individual commits.

3 years agoAdd expected output for T9405
Ben Gamari [Thu, 24 Mar 2016 09:52:56 +0000 (05:52 -0400)] 
Add expected output for T9405

3 years agoDsExpr: Rip out static/dynamic check in list desugaring
Ben Gamari [Wed, 23 Mar 2016 16:24:45 +0000 (17:24 +0100)] 
DsExpr: Rip out static/dynamic check in list desugaring

Previously we would try to break explicit lists into a dynamic prefix
and static tail and desugar the former into a `build` expression.
Unfortunately, this heuristic resulted in surprising behavior
(see #11710) and wasn't pulling its weight. Here we drop it (along with
the `-fsimple-list-literals` flag), leaving only the list length
heuristic to determine whether `build` or cons list desugaring should be

Test Plan: Validate

Reviewers: simonpj, austin

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11710

3 years agoCreate empty dump files (fixes #10320)
Kai Harries [Wed, 23 Mar 2016 15:21:52 +0000 (16:21 +0100)] 
Create empty dump files (fixes #10320)

Test Plan: ./validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10320

3 years agoVarious ticky-related work
Joachim Breitner [Wed, 23 Mar 2016 15:20:36 +0000 (16:20 +0100)] 
Various ticky-related work

this Diff contains small, self-contained changes as I work towards
fixing #10613. It is mostly created to let harbormaster do its job, but
feedback is welcome as well.

Please do not merge this via arc; I’d like to push the individual
patches as layed out here. I might push mostly trivial ones even without
review, as long as the build passes.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

3 years agoAdd unicode syntax for banana brackets
Josh Price [Wed, 23 Mar 2016 15:19:01 +0000 (16:19 +0100)] 
Add unicode syntax for banana brackets

Add "⦇" and "⦈" as unicode alternatives for "(|" and "|)" respectively.

This must be implemented differently than other unicode additions
because ⦇" and "⦈" are interpretted as a $unigraphic rather than
a $unisymbol.

Test Plan: validate

Reviewers: goldfire, bgamari, austin

Reviewed By: bgamari, austin

Subscribers: thomie, mpickering

Differential Revision:

GHC Trac Issues: #10162

3 years agoClose ticky profiling file stream after printing (#9405)
Flaviu Andrei Csernik [Wed, 23 Mar 2016 15:18:11 +0000 (16:18 +0100)] 
Close ticky profiling file stream after printing (#9405)

Test Plan: T9405

Reviewers: simonmar, austin, bgamari

Reviewed By: simonmar, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #9405

3 years agoAdd `PatSynSigSkol` and modify `PatSynCtxt`
Rik Steenkamp [Wed, 23 Mar 2016 15:17:27 +0000 (16:17 +0100)] 
Add `PatSynSigSkol` and modify `PatSynCtxt`

As the type of a pattern synonym cannot in general be represented by a
value of type Type, we cannot use a value `SigSkol (PatSynCtxt n) (Check
ty)` to represent the signature of a pattern synonym (this causes
incorrect signatures to be printed in error messages). Therefore we now
represent it by a value `PatSynSigSkol n` (instead of incorrect
signatures we simply print no explicit signature).

Furthermore, we rename `PatSynCtxt` to `PatSynBuilderCtxt`, and use
`SigSkol (PatSynBuilderCtxt n) (Check ty)` to represent the type of a
bidirectional pattern synonym when used in an expression context.
Before, this type was represented by a value `SigSkol (PatSynCtxt n)
(Check ty)`, which caused incorrect error messages.

Also, in `mk_dict_err` of `typecheck\TcErrors.hs` we now distinguish
between all enclosing implications and "useful" enclosing implications,
for better error messages concerning pattern synonyms. See `Note [Useful

See the Phabricator page for examples.

Reviewers: mpickering, goldfire, simonpj, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11667

3 years agoErrUtils: Add timings to compiler phases
Ben Gamari [Wed, 23 Mar 2016 15:11:45 +0000 (16:11 +0100)] 
ErrUtils: Add timings to compiler phases

This adds timings and allocation figures to the compiler's output when
run with `-v2` in an effort to ease performance analysis.

  * Documentation
  * Where else should we add these?
  * Perhaps we should remove some of the now-arguably-redundant
    `showPass` occurrences where they are
  * Must we force more?
  * Perhaps we should place this behind a `-ftimings` instead of `-v2`

Test Plan: `ghc -v2 Test.hs`, look at the output

Reviewers: hvr, goldfire, simonmar, austin

Reviewed By: simonmar

Subscribers: angerman, michalt, niteria, ezyang, thomie

Differential Revision:

3 years agoEnsure T9646 dump-simpl output is cleaned
Ben Gamari [Sun, 20 Mar 2016 23:49:24 +0000 (00:49 +0100)] 
Ensure T9646 dump-simpl output is cleaned