2 months agoPrelRules: Don't break let/app invariant in shiftRule wip/backport-T16742
Ben Gamari [Mon, 10 Jun 2019 13:25:57 +0000 (09:25 -0400)] 
PrelRules: Don't break let/app invariant in shiftRule

Previously shiftRule would rewrite as invalid shift like
let x = I# (uncheckedIShiftL# n 80)
in ...
let x = I# (error "invalid shift")
in ...
However, this breaks the let/app invariant as `error` is not
okay-for-speculation. There isn't an easy way to avoid this so let's not
try. Instead we just take advantage of the undefined nature of invalid
shifts and return zero.

Fixes #16742.

(cherry picked from commit 0bd3b9dd0428855b6f72f757c1214b5253aa7753)

2 months agousers-guide: More release notes
Ben Gamari [Sat, 15 Jun 2019 18:55:05 +0000 (14:55 -0400)] 
users-guide: More release notes

2 months agoFix typo in 8.8.1 notes related to traceBinaryEvent
iustin [Fri, 26 Apr 2019 13:07:33 +0000 (09:07 -0400)] 
Fix typo in 8.8.1 notes related to traceBinaryEvent

- fixes double mention of `traceBinaryEvent#` (the second one should be `traceEvent#`, I think)
- fixes note about `traceEvent#` taking a `String` - the docs say it takes a zero-terminated ByteString.

(cherry picked from commit 63150b9e5583c5fc3252f242981b0d26f11348b2)

2 months agoAdd dwarf flavour definition ghc-8.8.1-alpha2
Ben Gamari [Thu, 13 Jun 2019 16:30:38 +0000 (12:30 -0400)] 
Add dwarf flavour definition

2 months agoMerge branches 'wip/backport-MR1137', 'wip/backport-MR1139', 'wip/backport-MR1160...
Ben Gamari [Thu, 13 Jun 2019 14:51:12 +0000 (10:51 -0400)] 
Merge branches 'wip/backport-MR1137', 'wip/backport-MR1139', 'wip/backport-MR1160', 'wip/backport-MR706' and 'wip/backport-MR769' into wip/ghc-8.8-merges

2 months agoBump process submodule to
Ben Gamari [Mon, 10 Jun 2019 16:36:11 +0000 (12:36 -0400)] 
Bump process submodule to

2 months agorts/linker: Use mmapForLinker to map PLT wip/backport-MR1139
Ben Gamari [Sat, 8 Jun 2019 19:31:54 +0000 (19:31 +0000)] 
rts/linker: Use mmapForLinker to map PLT

The PLT needs to be located within a close distance of
the code calling it under the small memory model.

Fixes #16784.

(cherry picked from commit 0b7f81f560c602f32cfc90fd3fb5f1c52f06ad49)

2 months agollvm-targets: Add armv7l-unknown-linux-gnueabi wip/backport-MR1160
Ben Gamari [Tue, 11 Jun 2019 01:59:19 +0000 (21:59 -0400)] 
llvm-targets: Add armv7l-unknown-linux-gnueabi

Fixes #15208.

[skip ci]

(cherry picked from commit 9b4ff57d71eebf6dd71a5d81d0f9c9c2aef80e65)

2 months agorts/linker: Only mprotect GOT after it is filled wip/backport-MR1137
Ben Gamari [Sat, 8 Jun 2019 17:28:19 +0000 (13:28 -0400)] 
rts/linker: Only mprotect GOT after it is filled

This fixes a regression, introduced by 67c422ca, where we mprotect'd the
global offset table (GOT) region to PROT_READ before we had finished
filling it, resulting in a linker crash.

Fixes #16779.

(cherry picked from commit 217e6db4af6752b13c586d4e8925a4a9a2f47245)

2 months agorts/linker: Make elf_got.c a bit more legible
Ben Gamari [Sat, 8 Jun 2019 17:28:08 +0000 (13:28 -0400)] 
rts/linker: Make elf_got.c a bit more legible

(cherry picked from commit bbc752c50f3adcb659cd8447635828e137a0a314)

2 months agoUse binary search to speedup checkUnload wip/backport-MR706
Phuong Trinh [Mon, 1 Apr 2019 19:05:47 +0000 (20:05 +0100)] 
Use binary search to speedup checkUnload

We are iterating through all object code for each heap objects when
checking whether object code can be unloaded. For large projects in
GHCi, this can be very expensive due to the large number of object code
that needs to be loaded/unloaded. To speed it up, this arrangess all
mapped sections of unloaded object code in a sorted array and use binary
search to check if an address location fall on them.

(cherry picked from commit f81f3964b718eab21f0cfe65067c195f2f2a84bd)

2 months agoAdd `-haddock` to and .gitlab-ci.yml wip/backport-MR769
Takenobu Tani [Sun, 14 Apr 2019 12:31:05 +0000 (21:31 +0900)] 
Add `-haddock` to and .gitlab-ci.yml

To cover ci conditions from ghc8.6 to 8.9, I add `-haddock` option
to `.circleci/` and .gitlab-ci.yml.
after including `mk/flavours/*`.

(cherry picked from commit c4f94320a7048a7f263d8d952d4e12cc0227cf72)

2 months agoAdd `-haddock` to rather than
Takenobu Tani [Sun, 14 Apr 2019 10:11:12 +0000 (19:11 +0900)] 
Add `-haddock` to rather than

To cover ci conditions from ghc8.6 to 8.9, I add `-haddock` option
to `mk/flavours/` rather than `.circleci/`.

Because in windows condition of ghc-8.9, `mk/flavours/*` is included
after ``.

In addition, in linux condition of ghc-8.6, `mk/flavors/` is used.

(cherry picked from commit 43a39c3c2195d5b4400efc845a54f153184b1d7f)

2 months agoAdd `-haddock` option under ci condition to fix #16415
Takenobu Tani [Sat, 13 Apr 2019 06:54:43 +0000 (15:54 +0900)] 
Add `-haddock` option under ci condition to fix #16415

In order to use the `:doc` command in ghci, it is necessary
to compile for core libraries with `-haddock` option.

Especially, the `-haddock` option is essential for release building.

  * The `-haddock` option may affect compile time and binary size.
  * But hadrian has already set `-haddock` as the default.
  * This patch affects the make-based building.

This patch has been split from !532.

(cherry picked from commit 33e37d0619a9d1d0b8088a109f7eeb4c6fd21027)

2 months agotestsuite: Mark threadstatus-T9333 as fragile in ghci way wip/backport-fragile
Ben Gamari [Mon, 8 Apr 2019 14:35:51 +0000 (10:35 -0400)] 
testsuite: Mark threadstatus-T9333 as fragile in ghci way

As noted in #16555.

(cherry picked from commit 64b1684da09ddb3dc480bd0370adc7b002657a39)

2 months agotestsuite: Fix fragile_for test modifier
Ben Gamari [Sat, 6 Apr 2019 13:37:52 +0000 (09:37 -0400)] 
testsuite: Fix fragile_for test modifier

(cherry picked from commit 658199cce0aabeed77f3bbbbde6abc0c5c3cc83d)

2 months agotestsuite: Mark T13167 as fragile in threaded2
Ben Gamari [Fri, 5 Apr 2019 02:25:23 +0000 (22:25 -0400)] 
testsuite: Mark T13167 as fragile in threaded2

As noted in #16536.

(cherry picked from commit b351004702c1a595bcedfa3ffeb4f816d5fd8503)

2 months agobase: Mark CPUTime001 as fragile
Ben Gamari [Thu, 30 May 2019 13:29:37 +0000 (09:29 -0400)] 
base: Mark CPUTime001 as fragile

As noted in #16224, CPUTime001 has been quite problematic, reporting
non-monotonic timestamps in CI. Unfortunately I've been unable to
reproduce this locally.

(cherry picked from commit 1a3420cabdcf6d7d90c154681230f1150604c097)

2 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.

(cherry picked from commit 23fc615679072a6fa433460a92f597af2ae388b2)

2 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

(cherry picked from commit 910185a3eb5fd2148e42d39f6374ab03d098b682)

2 months agotestsuite: Introduce fragile modifier
Ben Gamari [Tue, 26 Feb 2019 15:13:44 +0000 (10:13 -0500)] 
testsuite: Introduce fragile modifier

Now since we have been a bit more stringent in testsuite cleanliness we
have been marking a lot of tests as fragile using the `skip` modifier.
However, this unfortunately means that we lose the association with the
ticket number documenting the fragility.

Here we introduce `fragile` and `fragile_for` to retain this

(cherry picked from commit 4ca271d1880a6f4c5f49869de7f1920a2073adb6)

2 months agoBump binary to
Ben Gamari [Fri, 7 Jun 2019 21:34:16 +0000 (17:34 -0400)] 
Bump binary to

2 months agoBump Cabal submodule
Ben Gamari [Wed, 5 Jun 2019 00:37:31 +0000 (20:37 -0400)] 
Bump Cabal submodule

2 months agoBump time submodule to 1.9.3
Ben Gamari [Wed, 5 Jun 2019 00:34:27 +0000 (20:34 -0400)] 
Bump time submodule to 1.9.3

2 months agoBump terminfo to
Ben Gamari [Wed, 5 Jun 2019 00:31:38 +0000 (20:31 -0400)] 
Bump terminfo to

2 months agoHaddock for hiefile-header
Ben Gamari [Tue, 4 Jun 2019 22:59:31 +0000 (18:59 -0400)] 
Haddock for hiefile-header

2 months agoFix ghc-in-ghci
Ben Gamari [Tue, 4 Jun 2019 22:59:24 +0000 (18:59 -0400)] 
Fix ghc-in-ghci

2 months agoMerge branch '8.8-haddock-release' of into wip...
Ben Gamari [Tue, 4 Jun 2019 22:54:55 +0000 (18:54 -0400)] 
Merge branch '8.8-haddock-release' of into wip/ghc-8.8-merges

2 months agoAdd missing import
Ben Gamari [Tue, 4 Jun 2019 22:18:44 +0000 (18:18 -0400)] 
Add missing import

Missing from f8d24178f30b7837b35a9ea328bc6f520092ff08.

2 months agoMerge branch 'hiefile-header-8.8' of into wip...
Ben Gamari [Tue, 4 Jun 2019 22:07:26 +0000 (18:07 -0400)] 
Merge branch 'hiefile-header-8.8' of into wip/ghc-8.8-merges

2 months agoMerge branch 'wip/8-8-ghci' of into wip/ghc-8.8-merges
Ben Gamari [Tue, 4 Jun 2019 22:06:59 +0000 (18:06 -0400)] 
Merge branch 'wip/8-8-ghci' of into wip/ghc-8.8-merges

2 months agoMerge branch 'cherry-pick-e172a6d1' of into wip/ghc-8...
Ben Gamari [Tue, 4 Jun 2019 22:04:04 +0000 (18:04 -0400)] 
Merge branch 'cherry-pick-e172a6d1' of into wip/ghc-8.8-merges

2 months agoMerge branch 'wip/backport-ecc9366a0e0db107c286935130837b2222e2dd82' of https://gitla...
Ben Gamari [Tue, 4 Jun 2019 22:03:41 +0000 (18:03 -0400)] 
Merge branch 'wip/backport-ecc9366a0e0db107c286935130837b2222e2dd82' of into wip/ghc-8.8-merges

2 months agoMerge branch 'hie-backports-8.8' of into wip...
Ben Gamari [Tue, 4 Jun 2019 22:03:03 +0000 (18:03 -0400)] 
Merge branch 'hie-backports-8.8' of into wip/ghc-8.8-merges

2 months agoMerge remote-tracking branch 'osa1/port_16449_ghc_8_8' into wip/ghc-8.8-merges
Ben Gamari [Tue, 4 Jun 2019 22:02:11 +0000 (18:02 -0400)] 
Merge remote-tracking branch 'osa1/port_16449_ghc_8_8' into wip/ghc-8.8-merges

2 months agoMerge remote-tracking branch 'origin/cherry-pick-43a43a33' into wip/ghc-8.8-merges
Ben Gamari [Tue, 4 Jun 2019 22:01:54 +0000 (18:01 -0400)] 
Merge remote-tracking branch 'origin/cherry-pick-43a43a33' into wip/ghc-8.8-merges

2 months agoMerge remote-tracking branch 'osa1/backport_t16066' into wip/ghc-8.8-merges
Ben Gamari [Tue, 4 Jun 2019 22:00:59 +0000 (18:00 -0400)] 
Merge remote-tracking branch 'osa1/backport_t16066' into wip/ghc-8.8-merges

2 months agotestsuite: Mark concprog001 as fragile
Ben Gamari [Fri, 26 Apr 2019 04:54:21 +0000 (00:54 -0400)] 
testsuite: Mark concprog001 as fragile

Due to #16604.

2 months agoUse datatype for unboxed returns when loading ghc into ghci wip/8-8-ghci
Michael Sloan [Fri, 15 Mar 2019 00:26:51 +0000 (17:26 -0700)] 
Use datatype for unboxed returns when loading ghc into ghci

See #13101 and #15454

(cherry picked from commit 64959e51bf17a9f991cc345476a40515e7b32d81)

2 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

(cherry picked from commit c01d5af31c8feb634fc3dffc84e6e7ece61ba190)

2 months agoRemove unnecessary uses of UnboxedTuples pragma (see #13101 / #15454)
Michael Sloan [Thu, 14 Mar 2019 23:01:44 +0000 (16:01 -0700)] 
Remove unnecessary uses of UnboxedTuples pragma (see #13101 / #15454)

Also removes a couple unnecessary MagicHash pragmas

(cherry picked from commit 061276ea5d265eb3c23a3698f0a10f6a764ff4b4)

2 months agoAdd PlainPanic for throwing exceptions without depending on pprint
Michael Sloan [Thu, 14 Mar 2019 22:47:44 +0000 (15:47 -0700)] 
Add PlainPanic for throwing exceptions without depending on pprint

This commit splits out a subset of GhcException which do not depend on
pretty printing (SDoc), as a new datatype called
PlainGhcException. These exceptions can be caught as GhcException,
because 'fromException' will convert them.

The motivation for this change is that that the Panic module
transitively depends on many modules, primarily due to pretty printing
code.  It's on the order of about 130 modules.  This large set of
dependencies has a few implications:

1. To avoid cycles / use of boot files, these dependencies cannot
throw GhcException.

2. There are some utility modules that use UnboxedTuples and also use
`panic`. This means that when loading GHC into GHCi, about 130
additional modules would need to be compiled instead of
interpreted. Splitting the non-pprint exception throwing into a new
module resolves this issue. See #13101

(cherry picked from commit fe9034e9b4820214a8c703bd8a3146ce6eed37b8)

2 months agoHave GHCi use object code for UnboxedTuples modules #15454
Michael Sloan [Thu, 14 Mar 2019 06:04:41 +0000 (23:04 -0700)] 
Have GHCi use object code for UnboxedTuples modules #15454

The idea is to automatically enable -fobject-code for modules that use
UnboxedTuples, along with all the modules they depend on. When looking
into how to solve this, I was pleased to find that there was already
highly similar logic for enabling code generation when -fno-code is
specified but TemplateHaskell is used.

The state before this patch was that if you used unboxed tuples then you
had to enable `-fobject-code` globally rather than on a per module

2 months agoBump Haddock submodule to 2.23 release
Alec Theriault [Mon, 27 May 2019 14:28:47 +0000 (10:28 -0400)] 
Bump Haddock submodule to 2.23 release

This commit of Haddock is (hopefully) going to be the one corresponding
to a Hackage release of Haddock 2.23.

2 months agoMake header human readable
Zubin Duggal [Sat, 25 May 2019 18:08:35 +0000 (23:38 +0530)] 
Make header human readable

2 months agoFix and enforce validation of header for .hie files
Zubin Duggal [Thu, 23 May 2019 11:43:33 +0000 (17:13 +0530)] 
Fix and enforce validation of header for .hie files

Implements #16686

automatically generate hieVersion from ghc version

2 months agoHandle hs-boot files in -Wmissing-home-modules (#16551) cherry-pick-43a43a33
Krzysztof Gogolewski [Tue, 9 Apr 2019 11:51:29 +0000 (11:51 +0000)] 
Handle hs-boot files in -Wmissing-home-modules (#16551)

(cherry picked from commit 43a43a3319d68c1692df6acdf283109cb5c030d8)

2 months agoFix arity type of coerced types in CoreArity
Ömer Sinan Ağacan [Wed, 29 May 2019 10:18:58 +0000 (13:18 +0300)] 
Fix arity type of coerced types in CoreArity

Previously if we had

    f |> co

where `f` had arity type `ABot N` and `co` had arity M and M < N,
`arityType` would return `ABot M` which is wrong, because `f` is only
known to diverge when applied to `N` args, as described in Note

    If at = ABot n, then (f x1..xn) definitely diverges. Partial
    applications to fewer than n args may *or may not* diverge.

This caused incorrect eta expansion in the simplifier, causing #16066.

We now return `ATop M` for the same expression so the simplifier can't
assume partial applications of `f |> co` is divergent.

A regression test T16066 is also added.

2 months agoFix rewriting invalid shifts to errors
Ömer Sinan Ağacan [Fri, 24 May 2019 08:23:01 +0000 (11:23 +0300)] 
Fix rewriting invalid shifts to errors

Fixes #16449.

5341edf3 removed a code in rewrite rules for bit shifts, which broke the
"silly shift guard", causing generating invalid bit shifts or heap
overflow in compile time while trying to evaluate those invalid bit

The "guard" is explained in Note [Guarding against silly shifts] in

More specifically, this was the breaking change:

    --- a/compiler/prelude/PrelRules.hs
    +++ b/compiler/prelude/PrelRules.hs
    @@ -474,12 +474,11 @@ shiftRule shift_op
            ; case e1 of
                _ | shift_len == 0
                  -> return e1
    -             | shift_len < 0 || wordSizeInBits dflags < shift_len
    -             -> return (mkRuntimeErrorApp rUNTIME_ERROR_ID wordPrimTy
    -                                        ("Bad shift length" ++ show shift_len))

This patch reverts this change.

Two new tests added:

- T16449_1: The original reproducer in #16449. This was previously
  casing a heap overflow in compile time when CmmOpt tries to evaluate
  the large (invalid) bit shift in compile time, using `Integer` as the
  result type. Now it builds as expected. We now generate an error for
  the shift as expected.

- T16449_2: Tests code generator for large (invalid) bit shifts.

2 months agoImprove targetContents code docs
Daniel Gröber [Tue, 28 May 2019 13:59:26 +0000 (15:59 +0200)] 
Improve targetContents code docs

2 months agoAdd depanalPartial to make getting a partial modgraph easier
Daniel Gröber [Sun, 26 May 2019 09:28:34 +0000 (11:28 +0200)] 
Add depanalPartial to make getting a partial modgraph easier

As per @mpickering's suggestion on IRC this is to make the partial
module-graph more easily accessible for API clients which don't intend to
re-implementing depanal.

2 months agoPartialDownsweep: Add test for import errors
Daniel Gröber [Sun, 26 May 2019 09:24:47 +0000 (11:24 +0200)] 
PartialDownsweep: Add test for import errors

2 months agoCatch preprocessor errors in downsweep
Daniel Gröber [Sat, 25 May 2019 11:57:45 +0000 (13:57 +0200)] 
Catch preprocessor errors in downsweep

This changes the way preprocessor failures are presented to the
user. Previously the user would simply get an unlocated message on stderr
such as:

    `gcc' failed in phase `C pre-processor'. (Exit code: 1)

Now at the problematic source file is mentioned:

    A.hs:1:1: error:
        `gcc' failed in phase `C pre-processor'. (Exit code: 1)

This also makes live easier for GHC API clients as the preprocessor error
is now thrown as a SourceError exception.

2 months agoMake downsweep return all errors per-module instead of throwing some
Daniel Gröber [Sat, 25 May 2019 09:27:22 +0000 (11:27 +0200)] 
Make downsweep return all errors per-module instead of throwing some

This enables API clients to handle such errors instead of immideately
crashing in the face of some kinds of user errors, which is arguably quite
bad UX.

Fixes #10887

2 months agoRefactor summarise{File,Module} to extract checkSummaryTimestamp
Daniel Gröber [Fri, 24 May 2019 13:02:45 +0000 (15:02 +0200)] 
Refactor summarise{File,Module} to extract checkSummaryTimestamp

This introduces a slight change of behaviour in the interrest of keeping
the code simple: Previously summariseModule would not call
addHomeModuleToFinder for summaries that are being re-used but now we do.

We're forced to to do this in summariseFile because the file being
summarised might not even be on the regular search path! So if GHC is to
find it at all we have to pre-populate the cache with its location. For
modules however the finder cache is really just a cache so we don't have to
pre-populate it with the module's location.

As straightforward as that seems I did almost manage to introduce a bug (or
so I thought) because the call to addHomeModuleToFinder I copied from
summariseFile used to use `ms_location old_summary` instead of the
`location` argument to checkSummaryTimestamp. If this call were to
overwrite the existing entry in the cache that would have resulted in us
using the old location of any module even if it was, say, moved to a
different directory between calls to 'depanal'.

However it turns out the cache just ignores the location if the module is
already in the cache. Since summariseModule has to search for the module,
which has the side effect of populating the cache, everything would have
been fine either way.

Well I'm adding a test for this anyways: tests/depanal/OldModLocation.hs.

2 months agoRefactor summarise{File,Module} to reduce code duplication
Daniel Gröber [Fri, 24 May 2019 11:51:16 +0000 (13:51 +0200)] 
Refactor summarise{File,Module} to reduce code duplication

2 months agoRefactor downsweep to allow returning multiple errors per module
Daniel Gröber [Fri, 24 May 2019 07:57:39 +0000 (09:57 +0200)] 
Refactor downsweep to allow returning multiple errors per module

2 months agoMove throwErrors to HscTypes
Daniel Gröber [Sat, 1 Jun 2019 15:11:35 +0000 (17:11 +0200)] 
Move throwErrors to HscTypes

This, among other things, happened in 1ffee940a0 ("Fix warnings and fatal
parsing errors") on master.

2 months agoAdd failing test for #10887
Daniel Gröber [Sat, 25 May 2019 09:42:45 +0000 (11:42 +0200)] 
Add failing test for #10887

2 months agoExport GhcMake.downsweep
Daniel Gröber [Fri, 24 May 2019 13:03:02 +0000 (15:03 +0200)] 
Export GhcMake.downsweep

This is to enable #10887 as well as to make it possible to test downsweep
on its own in the testsuite.

2 months agodownsweep: Allow TargetFile not to exist when a buffer is given
Daniel Gröber [Mon, 20 May 2019 10:17:36 +0000 (12:17 +0200)] 
downsweep: Allow TargetFile not to exist when a buffer is given

Currently 'getRootSummary' will fail with an exception if a 'TargetFile' is
given but it does not exist even if an input buffer is passed along for
this target.

In this case it is not necessary for the file to exist since the buffer
will be used as input for the compilation pipeline instead of the file

2 months agoAllow using tagetContents for modules needing preprocessing
Daniel Gröber [Mon, 20 May 2019 09:58:55 +0000 (11:58 +0200)] 
Allow using tagetContents for modules needing preprocessing

This allows GHC API clients, most notably tooling such as
Haskell-IDE-Engine, to pass unsaved files to GHC more easily.

Currently when targetContents is used but the module requires preprocessing
'preprocessFile' simply throws an error because the pipeline does not
support passing a buffer.

This change extends `runPipeline` to allow passing the input buffer into
the pipeline. Before proceeding with the actual pipeline loop the input
buffer is immediately written out to a new tempfile.

I briefly considered refactoring the pipeline at large to pass around
in-memory buffers instead of files, but this seems needlessly complicated
since no pipeline stages other than Hsc could really support this at the

2 months agoAdd hPutStringBuffer utility
Daniel Gröber [Mon, 20 May 2019 04:03:49 +0000 (06:03 +0200)] 
Add hPutStringBuffer utility

2 months agoRTS: Fix restrictive cast
Alec Theriault [Mon, 13 May 2019 22:31:56 +0000 (15:31 -0700)] 
RTS: Fix restrictive cast

Commit e75a9afd2989e0460f9b49fa07c1667299d93ee9 added an `unsigned` cast
to account for OSes that have signed `rlim_t` signed. Unfortunately,
the `unsigned` cast has the unintended effect of narrowing `rlim_t` to
only 4 bytes. This leads to some spurious out of memory crashes
(in particular: Haddock crashes with OOM whenn building docs of

In this case, `W_` is a better type to cast to: we know it will be
unsigned too and it has the same type as `*len` (so we don't suffer from
accidental narrowing).

2 months agoEnable external interpreter when TH is requested but no internal interpreter is available cherry-pick-e172a6d1
Alp Mestanogullari [Fri, 3 May 2019 10:21:44 +0000 (10:21 +0000)] 
Enable external interpreter when TH is requested but no internal interpreter is available

(cherry picked from commit e172a6d127a65b945b31306ff7b6c43320debfb4)

2 months agoFix optSemi type in Parser.y
Vladislav Zavialov [Wed, 6 Feb 2019 01:01:36 +0000 (20:01 -0500)] 
Fix optSemi type in Parser.y

The definition of 'optSemi' claimed it had type

([Located a],Bool)

Note that its production actually returns ([Located Token],Bool):

  : ';' { ([$1],True) }   -- $1 :: Located Token

Due to an infelicity in the implementation of 'happy -c', it effectively
resulted in 'unsafeCoerce :: Token -> a'.

If any consumer of 'optSemi' tried to instantiate 'a' to something not
representationally equal to 'Token', they would experience a segfault.

In addition to that, this definition made it impossible to compile Parser.y
without the -c flag (as it's reliant on this bug to cast 'Token' to 'forall
a. a').

3 months agoFix #16603 by documenting some important changes in changelogs
Ryan Scott [Sat, 4 May 2019 15:05:20 +0000 (11:05 -0400)] 
Fix #16603 by documenting some important changes in changelogs

This addresses some glaring omissions from
`libraries/base/` and
`docs/users_guide/8.8.1-notes.rst`, fixing #16603 in the process.

3 months agogitlab-ci: Reintroduce DWARF-enabled bindists
Ben Gamari [Thu, 25 Apr 2019 21:13:58 +0000 (17:13 -0400)] 
gitlab-ci: Reintroduce DWARF-enabled bindists

It seems that this was inadvertently dropped in

3 months agousers-guide: Mention profiling break on 32-bit Windows
Ben Gamari [Thu, 25 Apr 2019 23:13:43 +0000 (19:13 -0400)] 
users-guide: Mention profiling break on 32-bit Windows

Due to #15934.

3 months agousers-guide: Drop old release notes
Ben Gamari [Thu, 25 Apr 2019 23:03:31 +0000 (19:03 -0400)] 
users-guide: Drop old release notes

3 months agoUpdate autoconf scripts ghc-8.8.1-alpha1
Ben Gamari [Wed, 24 Apr 2019 17:10:54 +0000 (13:10 -0400)] 
Update autoconf scripts

Scripts taken from autoconf a8d79c3130da83c7cacd6fee31b9acc53799c406

3 months agoGive it a three-component version number
Ben Gamari [Wed, 24 Apr 2019 17:26:42 +0000 (13:26 -0400)] 
Give it a three-component version number

3 months agogitlab-ci: Fix CI image names
Ben Gamari [Wed, 24 Apr 2019 16:39:52 +0000 (12:39 -0400)] 
gitlab-ci: Fix CI image names

3 months agogitlab-ci: Disable PDF building on Debian 8
Ben Gamari [Wed, 24 Apr 2019 05:14:32 +0000 (01:14 -0400)] 
gitlab-ci: Disable PDF building on Debian 8

3 months agogitlab-ci: Set LANG in centos7 build
Ben Gamari [Wed, 24 Apr 2019 04:42:30 +0000 (00:42 -0400)] 
gitlab-ci: Set LANG in centos7 build

Let's see if this fixes the testsuite failures.

3 months agogitlab-ci: Allow centos7 job to fail
Ben Gamari [Wed, 24 Apr 2019 04:42:21 +0000 (00:42 -0400)] 
gitlab-ci: Allow centos7 job to fail

4 months agogitlab-ci: Further tighten linter release tag condition
Ben Gamari [Tue, 23 Apr 2019 00:01:27 +0000 (20:01 -0400)] 
gitlab-ci: Further tighten linter release tag condition

4 months agotemplate-haskell: Fix TBAs in changelog
Ben Gamari [Mon, 22 Apr 2019 16:58:14 +0000 (12:58 -0400)] 
template-haskell: Fix TBAs in changelog

4 months agogitlab-ci: Only run release notes lint on release tags
Ben Gamari [Fri, 12 Apr 2019 15:10:48 +0000 (11:10 -0400)] 
gitlab-ci: Only run release notes lint on release tags

4 months agogitlab-ci: Add centos7 release job
Ben Gamari [Thu, 11 Apr 2019 22:22:51 +0000 (18:22 -0400)] 
gitlab-ci: Add centos7 release job

4 months agogitlab-ci: Do not build profiled libraries on 32-bit Windows
Ben Gamari [Fri, 19 Apr 2019 04:16:57 +0000 (00:16 -0400)] 
gitlab-ci: Do not build profiled libraries on 32-bit Windows

Due to #15934.

4 months agoFix error message for './configure' regarding '--with-ghc' [skip ci]
Alexandre Baldé [Tue, 9 Apr 2019 00:19:16 +0000 (01:19 +0100)] 
Fix error message for './configure' regarding '--with-ghc' [skip ci]

(cherry picked from commit 00245f7777854e9be1eeb4c7363e254d5ad7f25f)

4 months agoFix two bugs in stg_ap_0_fast in profiling runtime
Ömer Sinan Ağacan [Fri, 18 Jan 2019 19:35:37 +0000 (22:35 +0300)] 
Fix two bugs in stg_ap_0_fast in profiling runtime

This includes two bug fixes in profiling version of stg_ap_0_fast:

- PAPs allocated by stg_ap_0_fast are now correctly tagged. This
  invariant is checked in Sanity.c:checkPAP.

  (This was originally implemented in 2693eb11f5, later reverted with
  ab55b4ddb7 because it revealed the bug below, but it wasn't clear at
  the time whether the bug was the one below or something in the commit)

- The local variable `untaggedfun` is now marked as a pointer so it
  survives GC.

With this we finally fix all known bugs caught in #15508. `concprog001`
now works reliably with prof+threaded and prof runtimes (with and
without -debug).

(cherry picked from commit 908b4b8659713f0b7a1704ce33c7fa30e3e0ffc3)

4 months agousers-guide: Document how to disable package environments
Ben Gamari [Sun, 31 Mar 2019 20:22:04 +0000 (16:22 -0400)] 
users-guide: Document how to disable package environments

As noted in #16309 this somehow went undocumented.

(cherry picked from commit 36d380475d9056fdf93305985be3def00aaf6cf7)

4 months agoosReserveHeapMemory: handle signed rlim_t
Fraser Tweedale [Mon, 8 Apr 2019 07:27:06 +0000 (17:27 +1000)] 
osReserveHeapMemory: handle signed rlim_t

rlim_t is a signed type on FreeBSD, and the build fails with a
sign-compare error.  Add explicit (unsigned) cast to handle this

(cherry picked from commit 0fbad68df0171809bddb48e9753955cc232099eb)

4 months agogitlab: Remove doc-tarball job
Ben Gamari [Sat, 13 Apr 2019 13:31:41 +0000 (09:31 -0400)] 
gitlab: Remove doc-tarball job

4 months agoAllow unregisterised build to fail
Ben Gamari [Tue, 9 Apr 2019 20:20:08 +0000 (16:20 -0400)] 
Allow unregisterised build to fail

4 months agogitlab-ci: Allow failing build jobs to fail
Ben Gamari [Sun, 7 Apr 2019 01:55:37 +0000 (21:55 -0400)] 
gitlab-ci: Allow failing build jobs to fail

4 months agousers-guide: Add pretty to package list
Ben Gamari [Sat, 6 Apr 2019 16:26:38 +0000 (12:26 -0400)] 
users-guide: Add pretty to package list

4 months agogitlab-ci: Backport from master
Ben Gamari [Thu, 4 Apr 2019 15:14:03 +0000 (11:14 -0400)] 
gitlab-ci: Backport from master

4 months agoHadrian: introduce ways to skip some documentation targets
Alp Mestanogullari [Wed, 27 Feb 2019 16:23:48 +0000 (17:23 +0100)] 
Hadrian: introduce ways to skip some documentation targets

The initial motivation for this is to have a chance to run the binary
distribution rules in our Windows CI without having to install
sphinx-build and xelatex there, while retaining the ability to
generate haddocks. I just ended up extending this idea a little bit so
as to have control over whether we build haddocks, (sphinx) HTML manuals,
(sphinx) PDF manuals and (sphinx) manpages.

(cherry picked from commit 8442103aa575dc1cd25cb3231e729c6365dc1b5c)

4 months agoAdd werror function to Flavour.hs
Matthew Pickering [Thu, 31 Jan 2019 11:01:04 +0000 (11:01 +0000)] 
Add werror function to Flavour.hs

This function makes it easy to turn on `-Werror` in the correct manner
to mimic how CI turns on -Werror.

(cherry picked from commit 8dcd00cef7782c64b5484b106f4fd77c8c87e40a)

4 months agoconfigure: Always use AC_LINK_ELSEIF when testing against assembler
Ben Gamari [Sun, 31 Mar 2019 20:00:34 +0000 (16:00 -0400)] 
configure: Always use AC_LINK_ELSEIF when testing against assembler

This fixes #16440, where the build system incorrectly concluded that the
`.subsections_via_symbols` assembler directive was supported on a Linux
system. This was caused by the fact that gcc was invoked with `-flto`;
when so-configured gcc does not call the assembler but rather simply
serialises its AST for compilation during the final link.

This is described in Note [autoconf assembler checks and -flto].

(cherry picked from commit 7b090b53fea065d2cfd967ea919426af9ba8d737)

4 months agoRestore Xmm registers properly in StgCRun.c [Mon, 1 Apr 2019 14:17:41 +0000 (16:17 +0200)] 
Restore Xmm registers properly in StgCRun.c

This fixes #16514: Xmm6-15 was restored based off rax instead of rsp.
The code was introduced in the fix for #14619.

(cherry picked from commit 9b131500371a07626e33edc56700c12322364560)

4 months agoBump hpc submodule
Ryan Scott [Fri, 5 Apr 2019 15:24:12 +0000 (11:24 -0400)] 
Bump hpc submodule

Currently, the `hpc` submodule is pinned against the `wip/final-mfp`
branch, not against `master`. This pins it back against `master`.

4 months agoUse funPrec, not topPrec, to parenthesize GADT argument types
Ryan Scott [Wed, 3 Apr 2019 16:37:10 +0000 (12:37 -0400)] 
Use funPrec, not topPrec, to parenthesize GADT argument types

A simple oversight. Fixes #16527.

4 months agobase: Remove `Monad(fail)` method and reexport `MonadFail(fail)` instead
Herbert Valerio Riedel [Sat, 10 Nov 2018 00:12:52 +0000 (01:12 +0100)] 
base: Remove `Monad(fail)` method and reexport `MonadFail(fail)` instead

As per

Coauthored-by: Ben Gamari <>
4 months agoUpdate parallel submodule
Herbert Valerio Riedel [Mon, 11 Feb 2019 22:32:38 +0000 (23:32 +0100)] 
Update parallel submodule

4 months agoUpdate directory submodule
Herbert Valerio Riedel [Fri, 1 Feb 2019 21:48:07 +0000 (22:48 +0100)] 
Update directory submodule

4 months agoUpdate filepath submodule
Herbert Valerio Riedel [Fri, 1 Feb 2019 21:48:40 +0000 (22:48 +0100)] 
Update filepath submodule