6 months agoFix specification of load_load_barrier [skip-ci]
Peter Trommler [Wed, 20 Mar 2019 15:02:44 +0000 (16:02 +0100)] 
Fix specification of load_load_barrier [skip-ci]

6 months agoRemove unused XArrApp and XArrForm extension points
Ryan Scott [Wed, 20 Mar 2019 13:41:00 +0000 (09:41 -0400)] 
Remove unused XArrApp and XArrForm extension points

!301 removed the `HsArrApp` and `HsArrForm` constructors, which
renders the corresponding extension points `XArrApp` and `XArrForm`
useless. This patch finally rips them out.

6 months agobase: Depend upon shlwapi on Windows
Ben Gamari [Wed, 20 Mar 2019 13:16:15 +0000 (09:16 -0400)] 
base: Depend upon shlwapi on Windows

As noted in #16466, `System.Environment.getExecutablePath` depends upon
`PathFileExistsW` which is defined by `shlwapi`.

Fixes #16466.

6 months agoCheck.hs: Fix a few typos
Simon Jakobi [Tue, 19 Mar 2019 18:54:58 +0000 (19:54 +0100)] 
Check.hs: Fix a few typos

6 months agoPrint test suite results ("unexpected failures" etc.) in sorted order
Ömer Sinan Ağacan [Tue, 19 Mar 2019 09:53:51 +0000 (12:53 +0300)] 
Print test suite results ("unexpected failures" etc.) in sorted order

Fixes #16425

6 months agoReject nested predicates in impredicativity checking
Ryan Scott [Sun, 17 Mar 2019 13:37:27 +0000 (09:37 -0400)] 
Reject nested predicates in impredicativity checking

When GHC attempts to unify a metavariable with a type containing
foralls, it will be rejected as an occurrence of impredicativity.
GHC was /not/ extending the same treatment to predicate types, such
as in the following (erroneous) example from #11514:

foo :: forall a. (Show a => a -> a) -> ()
foo = undefined

This will attempt to instantiate `undefined` at
`(Show a => a -> a) -> ()`, which is impredicative. This patch
catches impredicativity arising from predicates in this fashion.

Since GHC is pickier about impredicative instantiations, some test
cases needed to be updated to be updated so as not to fall afoul of
the new validity check. (There were a surprising number of
impredicative uses of `undefined`!) Moreover, the `T14828` test case
now has slightly less informative types shown with `:print`. This is
due to a a much deeper issue with the GHCi debugger (see #14828).

Fixes #11514.

6 months agoAdd a bench flavour to Hadrian
Sebastian Graf [Fri, 15 Mar 2019 16:06:21 +0000 (17:06 +0100)] 
Add a bench flavour to Hadrian

6 months agoci: Add some descriptions of the stages
Ben Gamari [Fri, 15 Mar 2019 14:48:51 +0000 (10:48 -0400)] 
ci: Add some descriptions of the stages

6 months agoci: Move validate-x86_64-linux-deb9 to full-build stage
Ben Gamari [Fri, 15 Mar 2019 14:45:44 +0000 (10:45 -0400)] 
ci: Move validate-x86_64-linux-deb9 to full-build stage

The `build` stage is meant to be a minimal smoke test to weed out broken
commits. The `validate-x86_64-linux-deb9` build will generally catch a
subset of issues caught by `validate-x86_64-linux-deb9-debug` so only
the latter should be in `build`.

6 months agoGracefully handle error condition in Mach-O relocateSection
Artem Pyanykh [Sat, 16 Mar 2019 15:32:00 +0000 (18:32 +0300)] 
Gracefully handle error condition in Mach-O relocateSection

6 months agoDirectly test section alignment, fix internal reloc probing length
Artem Pyanykh [Sat, 16 Mar 2019 15:12:00 +0000 (18:12 +0300)] 
Directly test section alignment, fix internal reloc probing length

6 months agoAdd missing levels to SegmentProt enum
Artem Pyanykh [Mon, 25 Feb 2019 15:46:42 +0000 (18:46 +0300)] 
Add missing levels to SegmentProt enum

6 months agoAdd a linker test re: section alignment
Artem Pyanykh [Mon, 11 Feb 2019 11:05:34 +0000 (14:05 +0300)] 
Add a linker test re: section alignment

6 months agoAddress some todos and fixmes
Artem Pyanykh [Mon, 11 Feb 2019 11:05:30 +0000 (14:05 +0300)] 
Address some todos and fixmes

6 months agoUse segments for section layout
Artem Pyanykh [Mon, 11 Feb 2019 11:05:26 +0000 (14:05 +0300)] 
Use segments for section layout

6 months agoAdjust section placement and relocation logic for Mach-O
Artem Pyanykh [Thu, 21 Feb 2019 09:10:38 +0000 (12:10 +0300)] 
Adjust section placement and relocation logic for Mach-O

1. Place each section on a separate page to ensure required
alignment (wastes lots ot space, needs to be improved).
2. Unwire relocation logic from macho sections (the most fiddly part
is adjusting internal relocations).

Other todos:
0. Add a test for section alignment.
1. Investigate 32bit relocations!
2. Fix memory leak in ZEROPAGE section allocation.
3. Fix creating redundant jump islands for GOT.
4. Investigate more compact section placement.

6 months agotestsuite: Display observed exit code on failure due to bad exit code
Ben Gamari [Thu, 7 Mar 2019 15:13:13 +0000 (10:13 -0500)] 
testsuite: Display observed exit code on failure due to bad exit code

6 months agoTry again
Ben Gamari [Thu, 7 Mar 2019 04:34:52 +0000 (23:34 -0500)] 
Try again

6 months agotestsuite: Don't mark T5836 as broken
Ben Gamari [Wed, 6 Mar 2019 03:47:59 +0000 (22:47 -0500)] 
testsuite: Don't mark T5836 as broken

I believe removing __mingw_vsnwprintf from RtsSymbols fixed #16387.

6 months agoDon't mark cabal09 as broken
Ben Gamari [Wed, 6 Mar 2019 03:47:28 +0000 (22:47 -0500)] 
Don't mark cabal09 as broken

It doesn't fail reliably.

6 months agorts/RtsSymbols: Drop __mingw_vsnwprintf
Ben Gamari [Tue, 5 Mar 2019 16:58:18 +0000 (11:58 -0500)] 
rts/RtsSymbols: Drop __mingw_vsnwprintf

As described in #16387, this is already defined by mingw and
consequently defining it in the RTS as well leads to multiple definition
errors from the RTS linker at runtime.

6 months agotestsuite/plugins: Increase compile timeout on Windows
Ben Gamari [Tue, 5 Mar 2019 16:30:57 +0000 (11:30 -0500)] 
testsuite/plugins: Increase compile timeout on Windows

I think the linker is routinely eating through the timeout,
leading to many spurious failures.

6 months agotestsuite: Mark T10672 as broken
Ben Gamari [Tue, 5 Mar 2019 00:16:09 +0000 (19:16 -0500)] 
testsuite: Mark T10672 as broken

This test, which is only run on Windows, seems to be reliably timing

See #16390.

6 months agotestsuite/plugins: Add multi_cpu_race modifier on Windows
Ben Gamari [Tue, 5 Mar 2019 00:01:43 +0000 (19:01 -0500)] 
testsuite/plugins: Add multi_cpu_race modifier on Windows

A few tests previously failed with various failure modes. For instance,
  `plugin-recomp-change` fails with:

Wrong exit code for plugin-recomp-change()(expected 0 , actual 2 )
Stderr ( plugin-recomp-change ):
Simple Plugin Passes Queried
Got options:
Simple Plugin Pass Run
C://GitLabRunner//builds//8fc0e283//0//ghc//ghc//inplace//mingw//bin/ld.exe: cannot find -lHSplugin-recompilation-0.1-CPeObcGoBuvHdwBnpK9jQq
collect2.exe: error: ld returned 1 exit status
`gcc.exe' failed in phase `Linker'. (Exit code: 1)
make[2]: *** [Makefile:112: plugin-recomp-change] Error 1
*** unexpected failure for plugin-recomp-change(normal)

It's unclear whether the ghc-pkg concurrency issue mentioned in all.T is
the culprit but the set of tests that fail overlaps strongly with the
set of tests that lack the `multi_cpu_race` modifier. Let's see if
adding it fixes them.

6 months agotestsuite: Mark T16190 as broken on Windows
Ben Gamari [Mon, 4 Mar 2019 23:58:55 +0000 (18:58 -0500)] 
testsuite: Mark T16190 as broken on Windows

There seems to be some filepath funniness due to TH embedding going on
here. See #16389.

6 months agotestsuite: Mark T15904 as broken on Windows
Ben Gamari [Mon, 4 Mar 2019 23:52:59 +0000 (18:52 -0500)] 
testsuite: Mark T15904 as broken on Windows

It seems to look for some sort of manifest file. See #16388.

6 months agotestsuite: Mark T5836 as broken on Windows
Ben Gamari [Mon, 4 Mar 2019 23:49:01 +0000 (18:49 -0500)] 
testsuite: Mark T5836 as broken on Windows

See #16387.

6 months agotestsuite: Fix expected output on Windows for various ghci tests
Ben Gamari [Mon, 4 Mar 2019 23:43:35 +0000 (18:43 -0500)] 
testsuite: Fix expected output on Windows for various ghci tests

Broke as -Wimplicit-kind-vars no longer exists. Specifically ghci024,
ghci057 and T9293.

6 months agotestsuite: Mark T16219 and cabal09 as broken on Windows
Ben Gamari [Mon, 4 Mar 2019 23:40:48 +0000 (18:40 -0500)] 
testsuite: Mark T16219 and cabal09 as broken on Windows

See #16386.

6 months agoUpdate .gitlab-ci.yml
Matthew Pickering [Tue, 19 Mar 2019 10:02:07 +0000 (06:02 -0400)] 
Update .gitlab-ci.yml

6 months agogitlab-ci: Bump docker images
Ben Gamari [Tue, 19 Mar 2019 03:51:35 +0000 (23:51 -0400)] 
gitlab-ci: Bump docker images

To install lndir and un-break the source distribution job.

6 months agoRemove deprecated reinitializeGlobals
Krzysztof Gogolewski [Mon, 18 Mar 2019 18:36:26 +0000 (19:36 +0100)] 
Remove deprecated reinitializeGlobals

6 months agoSimplify monadic code
Krzysztof Gogolewski [Mon, 18 Mar 2019 18:34:00 +0000 (19:34 +0100)] 
Simplify monadic code

6 months agoFix typos
Krzysztof Gogolewski [Mon, 18 Mar 2019 18:31:19 +0000 (19:31 +0100)] 
Fix typos

6 months agoReplace nOfThem by replicate
Krzysztof Gogolewski [Mon, 18 Mar 2019 18:22:10 +0000 (19:22 +0100)] 
Replace nOfThem by replicate

6 months agousers-guide: Update Wiki URLs to point to GitLab
Takenobu Tani [Mon, 18 Mar 2019 13:07:06 +0000 (22:07 +0900)] 
users-guide: Update Wiki URLs to point to GitLab

The user's guide uses the `ghc-wiki` macro, and substitution rules
are complicated. So I manually edited `.rst` files without sed.

I changed `Commentary/Latedmd` only to a different page.
It is more appropriate as an example.

[ci skip]

6 months agoBump Cabal submodule to 3.0
Ben Gamari [Wed, 13 Mar 2019 20:37:29 +0000 (16:37 -0400)] 
Bump Cabal submodule to 3.0

Metric Increase:

6 months agoerr: clean up error handler
Tamar Christina [Mon, 31 Dec 2018 22:49:49 +0000 (22:49 +0000)] 
err: clean up error handler

6 months agogitlab-ci: Implement support for i386/Windows bindists
Ben Gamari [Tue, 5 Mar 2019 21:41:55 +0000 (16:41 -0500)] 
gitlab-ci: Implement support for i386/Windows bindists

7 months agogitlab-ci: Implement head.hackage jobs
Ben Gamari [Thu, 28 Feb 2019 04:33:12 +0000 (23:33 -0500)] 
gitlab-ci: Implement head.hackage jobs

7 months agogitlab-ci: Always build fedora27
Ben Gamari [Fri, 1 Mar 2019 15:39:22 +0000 (10:39 -0500)] 
gitlab-ci: Always build fedora27

This ends up being much easier to use than Debian 9 under NixOS.

7 months agoUpdate bug tracker link to point to gitlab instead of deprecated trac
Radosław Rowicki [Fri, 15 Mar 2019 22:20:42 +0000 (18:20 -0400)] 
Update bug tracker link to point to gitlab instead of deprecated trac

7 months agoExtract out use of UnboxedTuples from GHCi.Leak
Michael Sloan [Thu, 14 Mar 2019 23:12:09 +0000 (16:12 -0700)] 
Extract out use of UnboxedTuples from GHCi.Leak

See #13101 + #15454 for motivation.  This change reduces the number of
modules that need to be compiled to object code when loading GHC into

7 months agoghc-heap: Introduce closureSize
Ben Gamari [Wed, 13 Mar 2019 23:42:47 +0000 (19:42 -0400)] 
ghc-heap: Introduce closureSize

This function allows the user to compute the (non-transitive) size of a
heap object in words. The "closure" in the name is admittedly confusing
but we are stuck with this nomenclature at this point.

7 months agogitlab-ci: Generate source tarballs
Ben Gamari [Tue, 19 Feb 2019 15:00:02 +0000 (10:00 -0500)] 
gitlab-ci: Generate source tarballs

7 months agogitlab-ci: Generate documentation tarball
Ben Gamari [Wed, 6 Mar 2019 11:47:28 +0000 (06:47 -0500)] 
gitlab-ci: Generate documentation tarball

7 months agogitlab-ci: Explicitly set bindist tarball name
Ben Gamari [Wed, 6 Mar 2019 11:46:57 +0000 (06:46 -0500)] 
gitlab-ci: Explicitly set bindist tarball name

7 months agocompiler: Disable atomic renaming on Windows
Ben Gamari [Sat, 16 Mar 2019 12:57:43 +0000 (08:57 -0400)] 
compiler: Disable atomic renaming on Windows

As discussed in #16450, this feature regresses CI on Windows, causing
non-deterministic failures due to missing files.

7 months agoAdd location to the extra-constraints wildcard
Simon Peyton Jones [Wed, 13 Mar 2019 13:09:19 +0000 (13:09 +0000)] 
Add location to the extra-constraints wildcard

The extra-constraints wildcard had lost its location
(issue #16431).

Happily this is easy to fix.  Lots of error improvements.

7 months agoImprove error recovery in the typechecker
Simon Peyton Jones [Wed, 13 Mar 2019 11:15:20 +0000 (11:15 +0000)] 
Improve error recovery in the typechecker

Issue #16418 showed that we were carrying on too eagerly after a bogus
type signature was identified (a bad telescope in fact), leading to a
subsequent crash.

This led me in to a maze of twisty little passages in the typechecker's
error recovery, and I ended up doing some refactoring in TcRnMonad.
Some specfifics

* TcRnMonad.try_m is now called attemptM.

* I switched the order of the result pair in tryTc,
  to make it consistent with other similar functions.

* The actual exception used in the Tc monad is irrelevant so,
  to avoid polluting type signatures, I made tcTryM, a simple
  wrapper around tryM, and used it.

The more important changes are in

* TcSimplify.captureTopConstraints, where we should have been calling
  simplifyTop rather than reportUnsolved, so that levity defaulting
  takes place properly.

* TcUnify.emitResidualTvConstraint, where we need to set the correct
  status for a new implication constraint.  (Previously we ended up
  with an Insoluble constraint wrapped in an Unsolved implication,
  which meant that insolubleWC gave the wrong answer.

7 months agoAdd flavours link
Simon Peyton Jones [Thu, 14 Mar 2019 12:05:28 +0000 (08:05 -0400)] 
Add flavours link

7 months agoPPC NCG: Use liveness information in CmmCall
Peter Trommler [Tue, 11 Dec 2018 15:43:49 +0000 (16:43 +0100)] 
PPC NCG: Use liveness information in CmmCall

We make liveness information for global registers
available on `JMP` and `BCTR`, which were the last instructions
missing. With complete liveness information we do not need to
reserve global registers in `freeReg` anymore. Moreover we
assign R9 and R10 to callee saves registers.

Cleanup by removing `Reg_Su`, which was unused, from `freeReg`
and removing unused register definitions.

The calculation of the number of floating point registers is too
conservative. Just follow X86 and specify the constants directly.

Overall on PowerPC this results in 0.3 % smaller code size in nofib
while runtime is slightly better in some tests.

7 months agoReport better suggestion for GADT data constructor
Simon Peyton Jones [Wed, 13 Mar 2019 13:27:22 +0000 (13:27 +0000)] 
Report better suggestion for GADT data constructor

This addresses issue #16427. An easy fix.

7 months agoUpdate Trac ticket URLs to point to GitLab
Ryan Scott [Tue, 12 Mar 2019 22:15:38 +0000 (18:15 -0400)] 
Update Trac ticket URLs to point to GitLab

This moves all URL references to Trac tickets to their corresponding
GitLab counterparts.

7 months agoGit ignore .hadrian_ghci (generated by the ./hadrian/
David Eichmann [Tue, 12 Mar 2019 17:13:12 +0000 (17:13 +0000)] 
Git ignore .hadrian_ghci (generated by the ./hadrian/

[skip ci]

7 months agoHadrian: remove unneeded rpaths.
David Eichmann [Tue, 12 Mar 2019 17:06:04 +0000 (17:06 +0000)] 
Hadrian: remove unneeded rpaths.

Issue #12770

7 months agoHadrian: remove unneeded imports.
David Eichmann [Tue, 12 Mar 2019 12:00:18 +0000 (12:00 +0000)] 
Hadrian: remove unneeded imports.

7 months agoRemove the GHCi debugger's panicking isUnliftedType check
Ryan Scott [Tue, 12 Mar 2019 14:06:38 +0000 (10:06 -0400)] 
Remove the GHCi debugger's panicking isUnliftedType check

The GHCi debugger has never been that robust in the face of
higher-rank types, or even types that are _interally_ higher-rank,
such as the types of many class methods (e.g., `fmap`). In GHC 8.2,
however, things became even worse, as the debugger would start to
_panic_ when a user tries passing the name of a higher-rank thing
to `:print`. This all ties back to a strange `isUnliftedType` check
in `Debugger` that was mysteriously added 11 years ago
(in commit 4d71f5ee6dbbfedb4a55767e4375f4c0aadf70bb) with no
explanation whatsoever.

After some experimentation, no one is quite sure what this
`isUnliftedType` check is actually accomplishing. The test suite
still passes if it's removed, and I am unable to observe any
differences in debugger before even with data types that _do_ have
fields of unlifted types (e.g., `data T = MkT Int#`). Given that
this is actively causing problems (see #14828), the prudent thing
to do seems to be just removing this `isUnliftedType` check, and
waiting to see if anyone shouts about it. This patch accomplishes
just that.

Note that this patch fix the underlying issues behind #14828, as the
debugger will still print unhelpful info if you try this:

λ> f :: (forall a. a -> a) -> b -> b; f g x = g x
λ> :print f
f = (_t1::t1)

But fixing this will require much more work, so let's start with the
simple stuff for now.

7 months agotestsuite: Add testcase for #16394
Ben Gamari [Wed, 6 Mar 2019 01:33:51 +0000 (20:33 -0500)] 
testsuite: Add testcase for #16394

7 months agoFix #16411 by making dataConCannotMatch aware of (~~)
Ryan Scott [Sat, 9 Mar 2019 00:02:44 +0000 (19:02 -0500)] 
Fix #16411 by making dataConCannotMatch aware of (~~)

The `dataConCannotMatch` function (which powers the
`-Wpartial-fields` warning, among other things) had special reasoning
for explicit equality constraints of the form `a ~ b`, but it did
not extend that reasoning to `a ~~ b` constraints, leading to #16411.
Easily fixed.

7 months agoHadrian: build (and retrieve) binary distributions in CI
Alp Mestanogullari [Tue, 5 Mar 2019 18:01:54 +0000 (19:01 +0100)] 
Hadrian: build (and retrieve) binary distributions in CI

With all the recent fixes to the binary-dist rule in Hadrian, we can now run
that rule in CI and keep the bindists around in gitlab as artifacts, just like
we do for the make CI jobs.

To get 'autoreconf' to work in the Windows CI, we have to run it through the
shell interpreter, so this commit does that along the way.

7 months agotestsuite: Mark heapprof001 as fragile on all platforms
Ben Gamari [Sat, 2 Mar 2019 03:57:55 +0000 (22:57 -0500)] 
testsuite: Mark heapprof001 as fragile on all platforms

See #15382.

7 months agoRevert: Update ci-images commit
Matthew Pickering [Tue, 12 Mar 2019 13:44:45 +0000 (09:44 -0400)] 
Revert: Update ci-images commit

7 months agoCI: Update ci-images commit
Matthew Pickering [Tue, 12 Mar 2019 13:42:53 +0000 (09:42 -0400)] 
CI: Update ci-images commit

7 months agoAdd regression test for #16347
Ryan Scott [Mon, 11 Mar 2019 13:21:12 +0000 (09:21 -0400)] 
Add regression test for #16347

Commit 1f5cc9dc8aeeafa439d6d12c3c4565ada524b926 ended up
fixing #16347. Let's add a regression test to ensure that it stays

7 months agoRemove duplicate functions in StgCmmUtils, use functions from CgUtils
Ömer Sinan Ağacan [Mon, 11 Mar 2019 11:44:28 +0000 (14:44 +0300)] 
Remove duplicate functions in StgCmmUtils, use functions from CgUtils

Also remove unused arg from get_Regtable_addr_from_offset

7 months agoUse transSuperClasses in TcErrors
Simon Peyton Jones [Mon, 11 Mar 2019 10:02:31 +0000 (10:02 +0000)] 
Use transSuperClasses in TcErrors

Code in TcErrors was recursively using immSuperClasses,
which loops in the presence of UndecidableSuperClasses.

Better to use transSuperClasses instead, which has a loop-breaker
mechanism built in.

Fixes issue #16414.

7 months agoRemove trailing whitespace
Matthew Pickering [Sun, 10 Mar 2019 17:56:07 +0000 (17:56 +0000)] 
Remove trailing whitespace

7 months agoCI: Add ghc-in-ghci build job
Matthew Pickering [Sun, 10 Mar 2019 17:54:59 +0000 (17:54 +0000)] 
CI: Add ghc-in-ghci build job

This is a separate build job to the other hadrian jobs as it only takes
about 2-3 minutes to run from cold. The CI tests that the
`./hadrian/ghci` script loads `ghc/Main.hs` successfully.

7 months agoRemove training whitespace
Matthew Pickering [Sun, 10 Mar 2019 17:46:00 +0000 (17:46 +0000)] 
Remove training whitespace

7 months agoHadrian: Add ./hadrian/ script for fast development feedback
Matthew Pickering [Sun, 10 Mar 2019 17:43:10 +0000 (17:43 +0000)] 
Hadrian: Add ./hadrian/ script for fast development feedback

Running the `./hadrian/ghci` target will load the main compiler into
a ghci session. This is intended for fast development feedback, modules are only
typechecked so it isn't possible to run any functions in the repl.

You can also use this target with `ghcid`.

The first time this command is run hadrian will need to compile a few dependencies
which will take 1-2 minutes. Loading GHC into GHCi itself takes about 30 seconds.

Internally this works by calling a new hadrian target called `tool-args`.
This target prints out the package and include flags which are necessary
to load files into ghci. The same target is intended to be used by other
tooling which uses the GHC API in order to set up the correct GHC API
session. For example, using this target it is also possible to use HIE
when developing on GHC.

7 months agoHadrian: Fix rpath so shared objects work after being copied
Matthew Pickering [Sun, 10 Mar 2019 17:37:48 +0000 (17:37 +0000)] 
Hadrian: Fix rpath so shared objects work after being copied

After being copied all the shared objects end up in the same directory.
Therefore the correct rpath is `$ORIGIN` rather than the computed
path which is relative to the directory where it is built.

7 months agoHadrian: Make makeRelativeNoSysLink total
Matthew Pickering [Sun, 10 Mar 2019 17:36:32 +0000 (17:36 +0000)] 
Hadrian: Make makeRelativeNoSysLink total

makeRelativeNoSysLink would previously crash for no reason if the first
argument as `./` due to the call to `head`. This refactoring keeps the
behaviour the same but doesn't crash in this corner case.

7 months agoHadrian: Make libsuf and distDir stage aware
Matthew Pickering [Sun, 10 Mar 2019 17:34:42 +0000 (17:34 +0000)] 
Hadrian: Make libsuf and distDir stage aware

The version suffix needs to be the version of the stage 0 compiler
when building shared libraries with the stage 0 compiler.

7 months agoHadrian: Allow passing CABFLAGS into
Matthew Pickering [Sun, 10 Mar 2019 17:32:47 +0000 (17:32 +0000)] 
Hadrian: Allow passing CABFLAGS into

Setting `CABFLAGS=args` will pass the additional arguments to cabal
when it is invoked.

7 months agoAdd a test for Trac #13951
Krzysztof Gogolewski [Thu, 7 Mar 2019 18:08:59 +0000 (19:08 +0100)] 
Add a test for Trac #13951

It no longer gives a warning.

7 months agoChange the warning in substTy back to an assertion
Krzysztof Gogolewski [Thu, 7 Mar 2019 16:19:45 +0000 (17:19 +0100)] 
Change the warning in substTy back to an assertion

We'd like to enforce the substitution invariant (Trac #11371).
In a492af06d326453 the assertion was downgraded to a warning;
I'm restoring the assertion and making the calls that
don't maintain the invariant as unchecked.

7 months agoIgnore more version numbers in the testsuite
Alec Theriault [Mon, 4 Mar 2019 16:45:54 +0000 (08:45 -0800)] 
Ignore more version numbers in the testsuite

Prevents some tests from failing just due to mismatched version numbers.

These version numbers shouldn't cause tests to fail, especially since
we *expect* them to be regularly incremented. The motivation for this
particular set of changes came from the changes that came along with
the `base` version bump in 8f19ecc95fbaf2cc977531d721085d8441dc09b7.

7 months agoDrop utils/count_lines
Ben Gamari [Fri, 8 Mar 2019 15:29:42 +0000 (10:29 -0500)] 
Drop utils/count_lines

This doesn't appear to be used anywhere in the build system and it
relies on perl. Drop it.

7 months agoRip out perl dependency
Ben Gamari [Fri, 8 Mar 2019 15:24:17 +0000 (10:24 -0500)] 
Rip out perl dependency

The object splitter was the last major user of perl. There remain a few
uses in nofib but we can just rely on the system's perl for this since
it's not critical to the build.

7 months agoNCG: correctly escape path strings on Windows (#16389)
Sylvain Henry [Fri, 8 Mar 2019 11:53:43 +0000 (12:53 +0100)] 
NCG: correctly escape path strings on Windows (#16389)

GHC native code generator generates .incbin and .file directives. We
need to escape those strings correctly on Windows (see #16389).

7 months agoMake bkpcabal01 test compatible with new ordering requirements.
Edward Z. Yang [Fri, 8 Mar 2019 04:47:07 +0000 (23:47 -0500)] 
Make bkpcabal01 test compatible with new ordering requirements.

Previously, our test did something like this:

1. Typecheck p
2. Typecheck q (which made use of an instantiated p)
3. Build instantiated p
4. Build instantiated q

Cabal previously permitted this, under the reasoning that during
typechecking there's no harm in using the instantiated p even if we
haven't build it yet; we'll just instantiate it on the fly with p.

However, this is not true!  If q makes use of a Template Haskell
splice from p, we absolutely must have built the instantiated p
before we typecheck q, since this typechecking will need to
run some splices.  Cabal now complains that you haven't done
it correctly, which we indeed have not!

Reordering so that we do this:

1. Typecheck p
3. Build instantiated p
2. Typecheck q (which made use of an instantiated p)
4. Build instantiated q

Fixes the problem.  If Cabal had managed the ordering itself, it would
have gotten it right.

Signed-off-by: Edward Z. Yang <>
7 months agorts: Factor out large bitmap walking
Ben Gamari [Tue, 5 Feb 2019 15:59:32 +0000 (10:59 -0500)] 
rts: Factor out large bitmap walking

This will be needed by the mark phase of the non-moving collector
so let's factor it out.

7 months agocompiler: Refactor: extract `withAtomicRename`
Niklas Hambüchen [Sun, 17 Feb 2019 20:09:29 +0000 (21:09 +0100)] 
compiler: Refactor: extract `withAtomicRename`

7 months agocompiler: Write .o files atomically. See #14533
Niklas Hambüchen [Sun, 17 Feb 2019 19:48:45 +0000 (20:48 +0100)] 
compiler: Write .o files atomically. See #14533

This issue was reproduced with, and the fix confirmed with,
the `hatrace` tool for syscall-based fault injection:

The concrete test case for GHC is at

A previous, nondeterministic reproducer for the issue was provided by
Alexey Kuleshevich in

Signed-off-by: Niklas Hambüchen <>
Reviewed-by: Alexey Kuleshevich <>
7 months agoStop inferring over-polymorphic kinds
Simon Peyton Jones [Thu, 21 Feb 2019 15:27:17 +0000 (15:27 +0000)] 
Stop inferring over-polymorphic kinds

Before this patch GHC was trying to be too clever
(Trac #16344); it succeeded in kind-checking this
polymorphic-recursive declaration

    data T ka (a::ka) b
      = MkT (T Type           Int   Bool)
            (T (Type -> Type) Maybe Bool)

As Note [No polymorphic recursion] discusses, the "solution" was
horribly fragile.  So this patch deletes the key lines in
TcHsType, and a wodge of supporting stuff in the renamer.

There were two regressions, both the same: a closed type family
decl like this (T12785b) does not have a CUSK:
  type family Payload (n :: Peano) (s :: HTree n x) where
    Payload Z (Point a) = a
    Payload (S n) (a `Branch` stru) = a

To kind-check the equations we need a dependent kind for
Payload, and we don't get that any more.  Solution: make it
a CUSK by giving the result kind -- probably a good thing anyway.

The other case (T12442) was very similar: a close type family
declaration without a CUSK.

7 months agoFix #13839: GHCi warnings do not respect the default module header
Roland Senn [Sat, 2 Mar 2019 15:53:06 +0000 (16:53 +0100)] 
Fix #13839: GHCi warnings do not respect the default module header

7 months agoTH: support raw bytes literals (#14741)
Sylvain Henry [Fri, 18 Jan 2019 11:30:31 +0000 (12:30 +0100)] 
TH: support raw bytes literals (#14741)

GHC represents String literals as ByteString internally for efficiency
reasons. However, until now it wasn't possible to efficiently create
large string literals with TH (e.g. to embed a file in a binary, cf #14741):
TH code had to unpack the bytes into a [Word8] that GHC then had to re-pack
into a ByteString.

This patch adds the possibility to efficiently create a "string" literal
from raw bytes. We get the following compile times for different sizes
of TH created literals:

|| Size || Before || After  || Gain ||
|| 30K  || 2.307s || 2.299  || 0%   ||
|| 3M   || 3.073s || 2.400s || 21%  ||
|| 30M  || 8.517s || 3.390s || 60%  ||

Ticket #14741 can be fixed if the original code uses this new TH feature.

7 months agoUse captureTopConstraints in TcRnDriver calls
Simon Peyton Jones [Thu, 7 Mar 2019 09:09:13 +0000 (09:09 +0000)] 
Use captureTopConstraints in TcRnDriver calls

Trac #16376 showed the danger of failing to report an error
that exists only in the unsolved constraints, if an exception
is raised (via failM).

Well, the commit 5c1f268e (Fail fast in solveLocalEqualities)
did just that -- i.e. it found errors in the constraints, and
called failM to avoid a misleading cascade.

So we need to be sure to call captureTopConstraints to report
those insolubles.  This was wrong in TcRnDriver.tcRnExpr and
in TcRnDriver.tcRnType.

As a result the error messages from test T13466 improved slightly,
a happy outcome.

7 months agoTestsuite: use 'fragile' instead of 'skip' for T3424, T14697
Vladislav Zavialov [Thu, 7 Mar 2019 07:33:41 +0000 (10:33 +0300)] 
Testsuite: use 'fragile' instead of 'skip' for T3424, T14697

Also, replace some tabs with spaces to avoid a "mixed indent" warning that vim
gives me.

7 months agoHadrian: Drop remaining symlink traversal code from build scripts
Andrey Mokhov [Wed, 6 Mar 2019 13:42:27 +0000 (13:42 +0000)] 
Hadrian: Drop remaining symlink traversal code from build scripts

This partly resolves #16325 (

As previously discussed in,
we do not need the symlink traversal code in build scripts. However, it
appears we forgot to delete this code from our Stack-based build scripts,
which led to placing all build artefacts in an unexpected location when
using Hadrian in combination with symlink trees. This commit fixes this.

7 months agoHadrian: various improvements around the 'test' rule
Alp Mestanogullari [Tue, 5 Mar 2019 12:22:46 +0000 (13:22 +0100)] 
Hadrian: various improvements around the 'test' rule

- introduce a -k/--keep-test-files flag to prevent cleanup
- add -dstg-lint to the options that are always passed to tests
- infer library ways from the compiler to be tested instead of getting them
  from the flavour (like make)
- likewise for figuring out whether the compiler to be tested is "debugged"
- specify config.exeext
- correctly specify config.in_tree_compiler, instead of always passing True
- fix formatting of how we pass a few test options
- add (potential) extensions to check-* program names
- build check-* programs with the compiler to be tested
- set TEST_HC_OPTS_INTERACTIVE and PYTHON env vars when running tests

7 months agoAlways do the worker/wrapper split for NOINLINEs
Sebastian Graf [Tue, 19 Feb 2019 12:52:11 +0000 (13:52 +0100)] 
Always do the worker/wrapper split for NOINLINEs

Trac #10069 revealed that small NOINLINE functions didn't get split
into worker and wrapper. This was due to `certainlyWillInline`
saying that any unfoldings with a guidance of `UnfWhen` inline
unconditionally. That isn't the case for NOINLINE functions, so we
catch this case earlier now.

Nofib results:

        Program         Allocs    Instrs
 fannkuch-redux          -0.3%      0.0%
             gg          +0.0%     +0.1%
       maillist          -0.2%     -0.2%
        minimax           0.0%     -0.8%
            Min          -0.3%     -0.8%
            Max          +0.0%     +0.1%
 Geometric Mean          -0.0%     -0.0%

Fixes #10069.

Metric Increase:

7 months agoFix #16391 by using occCheckExpand in TcValidity
Ryan Scott [Wed, 6 Mar 2019 19:42:02 +0000 (14:42 -0500)] 
Fix #16391 by using occCheckExpand in TcValidity

The type-variables-escaping-their-scope-via-kinds check in
`TcValidity` was failing to properly expand type synonyms, which led
to #16391. This is easily fixed by using `occCheckExpand` before
performing the validity check.

Along the way, I refactored this check out into its own function,
and sprinkled references to Notes to better explain all of the moving
parts. Many thanks to @simonpj for the suggestions.

Bumps the haddock submodule.

7 months agoFix #16392: revertCAFs in external interpreter when necessary
Phuong Trinh [Tue, 5 Mar 2019 15:48:46 +0000 (15:48 +0000)] 
Fix #16392: revertCAFs in external interpreter when necessary

We revert CAFs when loading/adding modules in ghci (presumably to refresh
execution states and to allow for object code to be unloaded from the runtime).
However, with `-fexternal-interpreter` enabled, we are only doing it in the
ghci process instead of the external interpreter process where the cafs are
allocated and computed. This makes sure that revertCAFs is done in the
appropriate process no matter if that flag is present or not.

7 months agoTest Trac #16263
Simon Peyton Jones [Wed, 6 Mar 2019 10:17:12 +0000 (10:17 +0000)] 
Test Trac #16263

7 months agoAdd tests for Trac #16221 and #16342
Simon Peyton Jones [Wed, 6 Mar 2019 09:54:06 +0000 (09:54 +0000)] 
Add tests for Trac #16221 and #16342

7 months agogitlab-ci: Don't allow i386-deb9 to fail
Ben Gamari [Tue, 26 Feb 2019 15:14:15 +0000 (10:14 -0500)] 
gitlab-ci: Don't allow i386-deb9 to fail

Also account for testsuite metric drift.

Metric Increase:

7 months agotestsuite: Use fragile modifier for more tests
Ben Gamari [Tue, 26 Feb 2019 15:24:31 +0000 (10:24 -0500)] 
testsuite: Use fragile modifier for more tests

7 months agotestsuite: Mark heapprof001 as fragile on i386
Ben Gamari [Tue, 26 Feb 2019 15:14:02 +0000 (10:14 -0500)] 
testsuite: Mark heapprof001 as fragile on i386