3 months agoRemove duplicates from 'ghc --info' output
Alp Mestanogullari [Fri, 14 Jun 2019 09:57:38 +0000 (11:57 +0200)] 
Remove duplicates from 'ghc --info' output

3 months agogitlab-ci: Lint the linters
Ben Gamari [Wed, 12 Jun 2019 15:11:31 +0000 (11:11 -0400)] 
gitlab-ci: Lint the linters

3 months agolint: Only apply --interactive lint to testsuite .T files
Ben Gamari [Wed, 12 Jun 2019 14:54:48 +0000 (10:54 -0400)] 
lint: Only apply --interactive lint to testsuite .T files

3 months agogitlab-ci: Lint testsuite for framework failures
Ben Gamari [Wed, 12 Jun 2019 13:37:13 +0000 (09:37 -0400)] 
gitlab-ci: Lint testsuite for framework failures

This introduces a new lint job checking for framework failures and
listing broken tests.

3 months agoPrelRules: Don't break let/app invariant in shiftRule
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.

3 months agoImplement the -XUnliftedNewtypes extension.
Andrew Martin [Sun, 12 May 2019 13:23:25 +0000 (09:23 -0400)] 
Implement the -XUnliftedNewtypes extension.

GHC Proposal: 0013-unlifted-newtypes.rst
Issues: #15219, #1311, #13595, #15883
Implementation Details:
  Note [Implementation of UnliftedNewtypes]
  Note [Unifying data family kinds]
  Note [Compulsory newtype unfolding]

This patch introduces the -XUnliftedNewtypes extension. When this
extension is enabled, GHC drops the restriction that the field in
a newtype must be of kind (TYPE 'LiftedRep). This allows types
like Int# and ByteArray# to be used in a newtype. Additionally,
coerce is made levity-polymorphic so that it can be used with
newtypes over unlifted types.

The bulk of the changes are in TcTyClsDecls.hs. With -XUnliftedNewtypes,
getInitialKind is more liberal, introducing a unification variable to
return the kind (TYPE r0) rather than just returning (TYPE 'LiftedRep).
When kind-checking a data constructor with kcConDecl, we attempt to
unify the kind of a newtype with the kind of its field's type. When
typechecking a data declaration with tcTyClDecl, we again perform a
unification. See the implementation note for more on this.

Co-authored-by: Richard Eisenberg <>
3 months agoAdd Outputable instances for Float, Double.
Andreas Klebinger [Thu, 13 Jun 2019 15:07:45 +0000 (17:07 +0200)] 
Add Outputable instances for Float, Double.

3 months agoHadrian: remove superfluous dependencies in Rules.Compile
Alp Mestanogullari [Tue, 11 Jun 2019 12:27:17 +0000 (14:27 +0200)] 
Hadrian: remove superfluous dependencies in Rules.Compile

Each package's object files were 'need'ing the library files of all transitive
dependencies of the current package, whichi is pointless since the said
libraries are not needed until we link those object files together.

This fixes #16759.

3 months agoRemove unused Unique field from StgFCallOp
Ömer Sinan Ağacan [Mon, 10 Jun 2019 09:40:37 +0000 (12:40 +0300)] 
Remove unused Unique field from StgFCallOp

Fixes #16696

3 months agoMaintain separate flags for C++ compiler invocations
Ben Gamari [Mon, 3 Jun 2019 22:51:17 +0000 (18:51 -0400)] 
Maintain separate flags for C++ compiler invocations

Previously we would pass flags intended for the C compiler to the C++
compiler (see #16738). This would cause, for instance, `-std=gnu99` to
be passed to the C++ compiler, causing spurious test failures. Fix this
by maintaining a separate set of flags for C++ compilation invocations.

3 months agogitlab-ci: Disable validate-x86_64-linux-deb9 job to reduce load
Ben Gamari [Wed, 12 Jun 2019 05:36:33 +0000 (01:36 -0400)] 
gitlab-ci: Disable validate-x86_64-linux-deb9 job to reduce load

Enable artifacts on to ensure we have bindist coverage.

3 months agogitlab-ci: Disable deb9-llvm job, introduce nightly LLVM job
Ben Gamari [Wed, 12 Jun 2019 05:14:32 +0000 (01:14 -0400)] 
gitlab-ci: Disable deb9-llvm job, introduce nightly LLVM job

This should help alleviate queue times as the LLVM job is one of the
longest that we have.

3 months agotestsuite: A more portable solution to #9399
Ben Gamari [Tue, 11 Jun 2019 13:54:55 +0000 (09:54 -0400)] 
testsuite: A more portable solution to #9399

Previously we used an awful hybrid batch script/Bourne shell script to
allow this test to run both on Windows and Linux (fixing #9399).
However, this breaks on some libc implementations (e.g. musl). Fix this.

Fixes #16798.

3 months agoClean up .circleci
Ben Gamari [Tue, 11 Jun 2019 03:47:47 +0000 (23:47 -0400)] 
Clean up .circleci

Move to .gitlab and remove everything else.

3 months agogitlab-ci: Don't build PDF user's guide on AArch64
Ben Gamari [Tue, 11 Jun 2019 23:48:56 +0000 (19:48 -0400)] 
gitlab-ci: Don't build PDF user's guide on AArch64

For reasons I don't understand sphinx seems to fail to produce a .idx
file for makeindex.

3 months agousers-guide: Fix a few markup issues
Ben Gamari [Tue, 11 Jun 2019 02:51:58 +0000 (22:51 -0400)] 
users-guide: Fix a few markup issues

Strangely these were only causing the build to fail in the aarch64-linux
job, despite Sphinx throwing errors in all jobs I checked.

Also changes some `#ifdef`s to `#if defined` to satisfy the linter.

3 months agoHadrian: Do not allow the Linux jobs to fail anymore
Alp Mestanogullari [Mon, 10 Jun 2019 18:55:12 +0000 (20:55 +0200)] 
Hadrian: Do not allow the Linux jobs to fail anymore

MR !1151 makes the Hadrian/Linux job pass by fixing the last two test failures,
so we can now be stricter and not allow those jobs to fail anymore, easily
letting us see when patches introduce test failures.

3 months agoHadrian: Track RTS library symlink targets
David Eichmann [Tue, 4 Jun 2019 18:01:19 +0000 (19:01 +0100)] 
Hadrian: Track RTS library symlink targets

This requires creating RTS library symlinks when registering, outside
of the rule for the registered library file.

3 months agoPrelRules: Ensure that string unpack/append rule fires with source notes
Ben Gamari [Tue, 4 Jun 2019 04:42:10 +0000 (00:42 -0400)] 
PrelRules: Ensure that string unpack/append rule fires with source notes

Previously the presence of source notes could hide nested applications
of `unpackFoldrCString#` from our constant folding logic. For instance,
consider the expression:

unpackFoldrCString# "foo" c (unpackFoldrCString# "baz" c n)

Specifically, ticks appearing in two places can defeat the rule:

  a. Surrounding the inner application of `unpackFoldrCString#`
  b. Surrounding the fold function, `c`

The latter caused the `str_rules` testcase to fail when `base` was built
with `-g3`.

Fixes #16740.

3 months agoFix #16525: ObjectCode freed wrongly because of lack of info header check
Phuong Trinh [Thu, 25 Apr 2019 17:44:02 +0000 (18:44 +0100)] 
Fix #16525: ObjectCode freed wrongly because of lack of info header check

`checkUnload` currently doesn't check the info header of static objects.
Thus, it may free an `ObjectCode` struct wrongly even if there's still a
live static object whose info header lies in a mapped section of that
`ObjectCode`. This fixes the issue by adding an appropriate check.

3 months agoAdd a few missing llvm-targets
Ben Gamari [Wed, 12 Jun 2019 18:24:23 +0000 (14:24 -0400)] 
Add a few missing llvm-targets

This should finally fix #14261.

[skip ci]

3 months agogitlab-ci: Bump Docker image
Ben Gamari [Wed, 12 Jun 2019 21:52:35 +0000 (17:52 -0400)] 
gitlab-ci: Bump Docker image

Fixes linters.

3 months agotestsuite: Don't run tests requiring TH in profasm way when GhcDynamic
Ben Gamari [Tue, 11 Jun 2019 19:56:07 +0000 (15:56 -0400)] 
testsuite: Don't run tests requiring TH in profasm way when GhcDynamic

Since we can't load profiled objects when GhcDynamic==YES. Affects:

* T16737
* T16384
* T16718
* T16619
* T16190

3 months agotestsuite: Unbreak galois_raytrace on i386
Ben Gamari [Tue, 11 Jun 2019 17:24:35 +0000 (13:24 -0400)] 
testsuite: Unbreak galois_raytrace on i386

galois_raytrace was previously broken on i386 due to use of x87
arithmethic on that platform. However,
42504f4a575395a35eec5c3fd7c9ef6e2b54e68e removes x87 support; this
resulted in an unexpected pass. Unmark this test as broken.

3 months agotestsuite: Skip cgrun078 in ghci way
Ben Gamari [Tue, 11 Jun 2019 05:09:17 +0000 (01:09 -0400)] 
testsuite: Skip cgrun078 in ghci way

This test requires FFI usage.

3 months agoprocess: Bump submodule
Ben Gamari [Mon, 10 Jun 2019 13:52:08 +0000 (09:52 -0400)] 
process: Bump submodule

 * Skip process005 in ghci way
 * Mark process002 as fragile in threaded2

3 months agoBump unix submodule
Ben Gamari [Sat, 6 Apr 2019 18:45:52 +0000 (14:45 -0400)] 
Bump unix submodule

Marks posix002 as fragile in threaded2 way due to #16550.

3 months agoFix uses of #ifdef/#ifndef
Ben Gamari [Sun, 9 Jun 2019 13:50:41 +0000 (09:50 -0400)] 
Fix uses of #ifdef/#ifndef

The linter now enforces our preference for `#if defined()` and
`#if !defined()`.

3 months agogitlab-ci: Fetch submodules before running submodule linter
Ben Gamari [Sun, 9 Jun 2019 16:31:32 +0000 (12:31 -0400)] 
gitlab-ci: Fetch submodules before running submodule linter

3 months agolinters/check-makefiles: Limit lint to Makefiles
Ben Gamari [Sun, 9 Jun 2019 14:36:58 +0000 (10:36 -0400)] 
linters/check-makefiles: Limit lint to Makefiles

Previously we would apply this rule, which is only intended for
testsuite Makefiles, to all files. This lead to a number of
false-positives in all.T files.

3 months agotestsuite: Note intentional typo in T7130
Ben Gamari [Tue, 11 Jun 2019 05:11:58 +0000 (01:11 -0400)] 
testsuite: Note intentional typo in T7130

I earlier accidentally corrected it breaking the test.

3 months agotestsuite: Mark T16737 as broken in ghci way due to #16541
Ben Gamari [Sun, 9 Jun 2019 13:32:55 +0000 (09:32 -0400)] 
testsuite: Mark T16737 as broken in ghci way due to #16541

3 months agotestsuite: Mark T16449_2 as broken due to #16742
Ben Gamari [Tue, 4 Jun 2019 04:56:47 +0000 (00:56 -0400)] 
testsuite: Mark T16449_2 as broken due to #16742

3 months agotestsuite: Skip T493 in ghci way.
Ben Gamari [Tue, 4 Jun 2019 04:53:09 +0000 (00:53 -0400)] 
testsuite: Skip T493 in ghci way.

T493 tests #493, which is an FFI test. FFI tests should be skipped
in ghci way.

3 months agotestsuite: Omit profasm way for cc017
Ben Gamari [Tue, 4 Jun 2019 00:59:13 +0000 (20:59 -0400)] 
testsuite: Omit profasm way for cc017

cc017 requires TH but we can't load dynamic profiled objects.

3 months agotestsuite: Mark threadstatus-T9333 as fragile in ghci way
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.

3 months agotestsuite: Fix omit_ways usage
Ben Gamari [Sun, 7 Apr 2019 01:50:24 +0000 (21:50 -0400)] 
testsuite: Fix omit_ways usage

omit_ways expects a list but this was broken in several cases.

3 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

3 months agotestsuite: Skip T7919 in ghci way
Ben Gamari [Sat, 6 Apr 2019 16:09:35 +0000 (12:09 -0400)] 
testsuite: Skip T7919 in ghci way

It times out pretty reliably. It's not clear that much is gained by
running this test in the ghci way anyways.

3 months agotestsuite: Mark T2783 as fragile in threaded1
Ben Gamari [Sat, 6 Apr 2019 02:22:43 +0000 (22:22 -0400)] 
testsuite: Mark T2783 as fragile in threaded1

It was previously marked as broken but it passes non-deterministically.
See #2783.

3 months agotestsuite: Mark Overflow as broken in hpc way
Ben Gamari [Fri, 5 Apr 2019 11:47:31 +0000 (07:47 -0400)] 
testsuite: Mark Overflow as broken in hpc way

As noted in #16543.

3 months agotestsuite: Omit tcrun022 in hpc way
Ben Gamari [Fri, 5 Apr 2019 03:01:46 +0000 (23:01 -0400)] 
testsuite: Omit tcrun022 in hpc way

As noted in #16542, the expected rule doesn't fire. However, this
doesn't seem terribly surpring given the circumstances.

3 months agotestsuite: Mark T16180 as broken in ghci and ext-interp ways
Ben Gamari [Fri, 5 Apr 2019 02:55:00 +0000 (22:55 -0400)] 
testsuite: Mark T16180 as broken in ghci and ext-interp ways

As noted in #16541.

3 months agotestsuite: Mark T14761c as broken in hpc, profasm, and optasm ways
Ben Gamari [Fri, 5 Apr 2019 02:50:00 +0000 (22:50 -0400)] 
testsuite: Mark T14761c as broken in hpc, profasm, and optasm ways

As noted in #16540.

3 months agotestsuite: Mark T13910 as broken in optasm
Ben Gamari [Fri, 5 Apr 2019 02:38:06 +0000 (22:38 -0400)] 
testsuite: Mark T13910 as broken in optasm

Due to #16537.

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

3 months agotestsuite: Mark hWaitForInput-accurate-stdin as broken in threaded ways
Ben Gamari [Fri, 5 Apr 2019 01:57:05 +0000 (21:57 -0400)] 
testsuite: Mark hWaitForInput-accurate-stdin as broken in threaded ways

As noted in #16535.

3 months agogitlab-ci: Test using slowtest in deb9-debug job
Ben Gamari [Thu, 4 Apr 2019 16:12:14 +0000 (12:12 -0400)] 
gitlab-ci: Test using slowtest in deb9-debug job

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

(cherry picked from commit 1134488b4c9cef904ea82f22f1978646eea612df)

3 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

(cherry picked from commit fdb07571036b1498800589d45b61781e6acdd368)

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

(cherry picked from commit ff438786613f07df9b2d43eaeac49b13815d849d)

Metric Increase:

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

(cherry picked from commit 983ada70a013c7642a751f6e41587ff95b57d0f8)

3 months agoUse DeriveFunctor throughout the codebase (#15654)
Krzysztof Gogolewski [Sat, 8 Jun 2019 18:48:07 +0000 (20:48 +0200)] 
Use DeriveFunctor throughout the codebase (#15654)

3 months agorts/linker: Only mprotect GOT after it is filled
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.

3 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

3 months agotestsuite: Add haddock perf test output to gitignore
Ben Gamari [Mon, 10 Jun 2019 23:00:57 +0000 (19:00 -0400)] 
testsuite: Add haddock perf test output to gitignore

[skip ci]

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

Fixes #15208.

[skip ci]

3 months agotestsuite/mk/ rename 'ghc-config-mk' to 'ghc_config_mk'
Alp Mestanogullari [Mon, 10 Jun 2019 15:38:34 +0000 (17:38 +0200)] 
testsuite/mk/ rename 'ghc-config-mk' to 'ghc_config_mk'

Make/shell variable names which contain dashes can cause problems under
some conditions. The 'ghc-config-mk' variable from testsuite/mk/
that I made overridable (by Hadrian) in ba0aed2e was working as expected when
our Hadrian/Linux job was based off the deb8 Docker image, but broke when
I switched the job to use our deb9-based image, in 3d97bad6. The exact
circumstances/tool versions that trigger this problem are unknown, but
changing the variable's name to 'ghc_config_mk' lets us work around the issue.

This fixes the annth_compunits and annth_make test failures that showed up
when we switched the Hadrian/Linux job to use the deb9 environment.

3 months agoFix an error message in CheckUnload.c:searchHeapBlocks
Ömer Sinan Ağacan [Mon, 10 Jun 2019 08:36:49 +0000 (11:36 +0300)] 
Fix an error message in CheckUnload.c:searchHeapBlocks

3 months agorts/linker: Use mmapForLinker to map PLT
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.

3 months agorts/linker: Mmap into low memory on AArch64
Ben Gamari [Sat, 8 Jun 2019 19:30:48 +0000 (19:30 +0000)] 
rts/linker: Mmap into low memory on AArch64

This extends mmapForLinker to use the same low-memory mapping
strategy used on x86_64 on AArch64. See #16784.

3 months agoHadrian: teach the RTS that PROFILING implies TRACING
Alp Mestanogullari [Wed, 5 Jun 2019 22:40:32 +0000 (00:40 +0200)] 
Hadrian: teach the RTS that PROFILING implies TRACING

As discussed in #16744, both the Make and Hadrian build systems
have special code to always pass -eventlog whenever -prof or -debug
are passed. However, there is some similar logic in the RTS itself only
for defining TRACING when the DEBUG macro is defined, but no such logic
is implemented to define TRACING when the PROFILING macro is defined.
This patch adds such a logic and therefore fixes #16744.

3 months agorts/RtsFlags.c: mention that -prof too enables support for +RTS -l
Alp Mestanogullari [Thu, 30 May 2019 12:18:01 +0000 (14:18 +0200)] 
rts/RtsFlags.c: mention that -prof too enables support for +RTS -l

3 months agoMake `haddock_testsuite` respect `--test-accept`
Alec Theriault [Wed, 29 May 2019 11:33:35 +0000 (07:33 -0400)] 
Make `haddock_testsuite` respect `--test-accept`

Suppose you've made changes that affect the output of `haddockHtmlTest`
so that the following is failing:

    ./hadrian/ -c --only=haddockHtmlTest test

Then, the following will accept new output for Haddock's test cases.

    ./hadrian/ -c --only=haddockHtmlTest test --test-accept

You still do need to make sure those new changes (which show up in
Haddock's tree) get committed though.

Fixes #16694

3 months agoRefine the GHCI macro into HAVE[_{INTERNAL, EXTERNAL}]_INTERPRETER
Alp Mestanogullari [Mon, 6 May 2019 16:49:33 +0000 (18:49 +0200)] 

As discussed in #16331, the GHCI macro, defined through 'ghci' flags
in, and, is supposed to indicate
whether GHC is built with support for an internal interpreter, that runs in
the same process. It is however overloaded in a few places to mean
"there is an interpreter available", regardless of whether it's an internal
or external interpreter.

For the sake of clarity and with the hope of more easily being able to
build stage 1 GHCs with external interpreter support, this patch splits
the previous GHCI macro into 3 different ones:

- HAVE_INTERNAL_INTERPRETER: GHC is built with an internal interpreter
- HAVE_EXTERNAL_INTERPRETER: GHC is built with support for external interpreters

3 months agoWarn about unused packages
Yuras Shumovich [Mon, 21 Jan 2019 00:49:56 +0000 (19:49 -0500)] 
Warn about unused packages

Reviewers: bgamari, simonpj

Reviewed By: simonpj

Subscribers: hvr, simonpj, mpickering, rwbarton, carter

GHC Trac Issues: #15838

Differential Revision:

3 months agoghc-heap: Add closure_size_noopt test
Ben Gamari [Sun, 9 Jun 2019 14:56:32 +0000 (10:56 -0400)] 
ghc-heap: Add closure_size_noopt test

This adds a new test, only run in the `normal` way, to verify the size
of FUNs and PAPs.

3 months agotestsuite: Fix and extend closure_size test
Ben Gamari [Sat, 8 Jun 2019 03:15:45 +0000 (23:15 -0400)] 
testsuite: Fix and extend closure_size test

This was previously broken in several ways. This is fixed and it also
now tests arrays. Unfortunately I was unable to find a way to continue
testing PAP and FUN sizes; these simply depend too much upon the
behavior of the simplifier.

I also tried to extend this to test non-empty arrays as well but
unfortunately this was non-trivial as the array card size constant isn't
readily available from haskell.

Fixes #16531.

3 months agoRefactor the rules for .hi and .o into a single rule using `&%>` #16764
David Eichmann [Thu, 6 Jun 2019 11:50:42 +0000 (12:50 +0100)] 
Refactor the rules for .hi and .o into a single rule using `&%>` #16764

Currently the rule for .hi files just triggers (via need) the rule
for the .o file, and .o rule generates both the .o and .hi file.
Likewise for .o-boot and .hi-boot files. This is a bit of an abuse
of Shake, and in fact shake supports rules with multiple output
with the &%> function. This exact use case appears in Neil
Mitchell's paper *Shake Before Building* section 6.3.

3 months agoComments only: document newtypes' DataConWrapId
Richard Eisenberg [Fri, 31 May 2019 17:37:56 +0000 (13:37 -0400)] 
Comments only: document newtypes' DataConWrapId

3 months agoPrint role annotations in TemplateHaskell brackets (#16718)
Vladislav Zavialov [Sat, 1 Jun 2019 12:08:24 +0000 (15:08 +0300)] 
Print role annotations in TemplateHaskell brackets (#16718)

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

3 months agorts: Fix RetainerProfile early return with TREC_CHUNK
Daniel Gröber [Thu, 6 Jun 2019 06:14:19 +0000 (08:14 +0200)] 
rts: Fix RetainerProfile early return with TREC_CHUNK

When pop() returns with `*c == NULL` retainerProfile will immediately
return. All other code paths is pop() continue with the next stackElement
when this happens so it seems weird to me that TREC_CHUNK we would suddenly
abort everything even though the stack might still have elements left to

3 months agoRemove CPP ensuring word size is 32 or 64 bits around Addr# <-> int# primops
John Ericson [Tue, 4 Jun 2019 02:56:17 +0000 (22:56 -0400)] 
Remove CPP ensuring word size is 32 or 64 bits around Addr# <-> int# primops

It shouldn't be needed these days, and those primops are "highly
deprecated" anyways.

This fits with my plans because it removes one bit of target-dependence
of the builtin primops, and this is the hardest part of GHC to make

CC @carter

3 months agoComments only: document tcdDataCusk better.
Richard Eisenberg [Fri, 31 May 2019 17:28:42 +0000 (13:28 -0400)] 
Comments only: document tcdDataCusk better.

3 months agoHadrian: need CPP preprocessor dependencies #16660
David Eichmann [Tue, 16 Apr 2019 14:10:35 +0000 (15:10 +0100)] 
Hadrian: need CPP preprocessor dependencies #16660

Use the new -include-cpp-deps ghc option (#16521)
when generating .dependencies files in hadrian.
This is version gated as -include-cpp-deps is a
relatively new option.

3 months agotestsuite: Add test for #16509
Ben Gamari [Tue, 28 May 2019 03:00:16 +0000 (23:00 -0400)] 
testsuite: Add test for #16509

3 months agoDo not report error if Name in pragma is unbound
nineonine [Wed, 22 May 2019 04:34:27 +0000 (21:34 -0700)] 
Do not report error if Name in pragma is unbound

3 months agorts: Separate population of eventTypes from initial event generation
Ben Gamari [Wed, 15 May 2019 21:49:34 +0000 (17:49 -0400)] 
rts: Separate population of eventTypes from initial event generation

Previously these two orthogonal concerns were both implemented in
postHeaderEvents which made it difficult to send header events after RTS

3 months agoAdd disable/enable commands to ghci debugger #2215
Roland Senn [Tue, 14 May 2019 07:45:36 +0000 (09:45 +0200)] 
Add disable/enable commands to ghci debugger #2215

This patch adds two new commands `:enable` and `:disable` to the GHCi debugger.
Opposite to `:set stop <n> :continue` a breakpoint disabled with `:disable` will
not loose its previously set stop command.
A new field breakEnabled is added to the BreakLocation data structure to
track the enable/disable state. When a breakpoint is disabled with a `:disable`
command, the following happens:

The corresponding BreakLocation data element is searched dictionary of the
`breaks` field of the GHCiStateMonad. If the break point is found and not
already in the disabled state, the breakpoint is removed from bytecode.
The BreakLocation data structure is kept in the breaks list and the new
breakEnabled field is set to false.

The `:enable` command works similar.

The breaks field in the GHCiStateMonad was changed from an association list
to int `IntMap`.

3 months agoFix #16517 by bumping the TcLevel for method sigs
Richard Eisenberg [Wed, 5 Jun 2019 22:02:13 +0000 (18:02 -0400)] 
Fix #16517 by bumping the TcLevel for method sigs

There were actually two bugs fixed here:

1. candidateQTyVarsOfType needs to be careful that it does not
   try to zap metavariables from an outer scope as "naughty"
   quantification candidates. This commit adds a simple check
   to avoid doing so.

2. We weren't bumping the TcLevel in kcHsKindSig, which was used
   only for class method sigs. This mistake led to the acceptance

     class C a where
       meth :: forall k. Proxy (a :: k) -> ()

   Note that k is *locally* quantified. This patch fixes the
   problem by using tcClassSigType, which correctly bumps the
   level. It's a bit inefficient because tcClassSigType does other
   work, too, but it would be tedious to repeat much of the code
   there with only a few changes. This version works well and is

And, while updating comments, etc., I noticed that tcRnType was
missing a pushTcLevel, leading to #16767, which this patch also
fixes, by bumping the level. In the refactoring here, I also
use solveEqualities. This initially failed ghci/scripts/T15415,
but that was fixed by teaching solveEqualities to respect

This patch also cleans up some Notes around error generation that
came up in conversation.

Test case: typecheck/should_fail/T16517, ghci/scripts/T16767

3 months agoHandle trailing path separator in package DB names (#16360)
Kevin Buhr [Fri, 3 May 2019 23:15:44 +0000 (18:15 -0500)] 
Handle trailing path separator in package DB names (#16360)

Package DB directories with trailing separator (provided via
GHC_PACKAGE_PATH or via -package-db) resulted in incorrect calculation of
${pkgroot} substitution variable.  Keep the trailing separator while
resolving as directory or file, but remove it before dropping the last
path component with takeDirectory.

Closes #16360.

3 months agoSmall refactorings in ExtractDocs
Simon Jakobi [Sun, 5 May 2019 12:36:02 +0000 (14:36 +0200)] 
Small refactorings in ExtractDocs

3 months agotestsuite: Add test for #16514
Ben Gamari [Tue, 2 Apr 2019 15:59:06 +0000 (11:59 -0400)] 
testsuite: Add test for #16514

3 months agoIntroduce log1p and expm1 primops
chessai [Fri, 1 Feb 2019 18:01:46 +0000 (13:01 -0500)] 
Introduce log1p and expm1 primops

Previously log and exp were primitives yet log1p and expm1 were FFI
calls. Fix this non-uniformity.

3 months agotestsuite: Suppress ticks in T4918 output
Ben Gamari [Mon, 3 Jun 2019 20:51:51 +0000 (16:51 -0400)] 
testsuite: Suppress ticks in T4918 output

As noted in #16741, this test otherwise breaks when `base` is compiled
with `-g`.

3 months agohadrian: Properly partition options in sourceArgs
Matthew Pickering [Thu, 30 May 2019 15:20:26 +0000 (16:20 +0100)] 
hadrian: Properly partition options in sourceArgs

Previously if you build the `ghc` package then it would has the default
opts and the library opts. This is different behaviour to make where the
library opts are only reserved for things in the `libraries`
subdirectory (I believe)

Fixes #16716

3 months agoExplain that 'mappend' and '(<>)' should be the same [skip ci]
Alexandre Baldé [Thu, 4 Apr 2019 23:48:06 +0000 (00:48 +0100)] 
Explain that 'mappend' and '(<>)' should be the same [skip ci]

3 months agogitlab-ci: Ensure that all commits on a branch are submodule-linted
Ben Gamari [Sat, 8 Jun 2019 20:44:55 +0000 (16:44 -0400)] 
gitlab-ci: Ensure that all commits on a branch are submodule-linted

The previous commit reworked things such that the submodule linter would
only run on the head commit. However, the linter only checks the
submodules which are touched by the commits it is asked to lint.
Consequently it would be possible for a bad submodule to sneak through.

Thankfully, we can use the handy CI_COMMIT_BEFORE_SHA attribute to
find the base commit of the push.

3 months agogitlab-ci: Fix submodule linting of commits
Ben Gamari [Sat, 8 Jun 2019 18:39:27 +0000 (14:39 -0400)] 
gitlab-ci: Fix submodule linting of commits

There is no notion of a base commit when we aren't checking a merge
request. Just check the HEAD commit.

3 months agogitlab-ci: Disable shallow clones
Ben Gamari [Sat, 8 Jun 2019 18:02:02 +0000 (14:02 -0400)] 
gitlab-ci: Disable shallow clones

Previously we were passing `--unshallow` to `git fetch` in the linting
rules to ensure that the base commit which we were linting with respect
to was available. However, this breaks due to GitLab's re-use of
working directories since `git fetch --unshallow` fails on a repository
which is not currently shallow.

Given that `git fetch --unshallow` circumvents the efficiencies provided
by shallow clones anyways, let's just disable them entirely.

There is no documented way to do disable shallow clones but on checking
the GitLab implementation it seems that setting `GIT_DEPTH=0` should do
the trick.

3 months agoRemove trailing whitespace
Matthew Pickering [Fri, 7 Jun 2019 13:33:13 +0000 (14:33 +0100)] 
Remove trailing whitespace

[skip ci]

This should really be caught by the linters! (#16711)

3 months agogitlab-ci: A few clarifying comments
Ben Gamari [Fri, 7 Jun 2019 15:14:42 +0000 (11:14 -0400)] 
gitlab-ci: A few clarifying comments

3 months agogitlab-ci: Fix submodule linter
Ben Gamari [Fri, 7 Jun 2019 15:14:07 +0000 (11:14 -0400)] 
gitlab-ci: Fix submodule linter

The job script didn't even try to compute the base commit to lint with
respect to.

3 months agogitlab-ci: Use --unshallow when fetching for linters
Ben Gamari [Fri, 7 Jun 2019 14:55:30 +0000 (10:55 -0400)] 
gitlab-ci: Use --unshallow when fetching for linters

GitLab creates a shallow clone. However, this means that we may not have
the base commit of an MR when linting, causing `git merge-base` to fail.
Fix this by passing `--unshallow` to `git fetch`, ensuring that we have
the entire history.

3 months agoFix two lint failures in rts/linker/MachO.c
Matthew Pickering [Thu, 30 May 2019 10:13:31 +0000 (11:13 +0100)] 
Fix two lint failures in rts/linker/MachO.c

3 months agogitlab-ci: Don't run two submodule checking jobs on Marge jobs
Matthew Pickering [Thu, 30 May 2019 10:12:12 +0000 (11:12 +0100)] 
gitlab-ci: Don't run two submodule checking jobs on Marge jobs

3 months agogitlab-ci: Linters, don't allow to fail
Matthew Pickering [Thu, 30 May 2019 10:11:04 +0000 (11:11 +0100)] 
gitlab-ci: Linters, don't allow to fail

Ben disabled them in cd85f8a71bb56cff332560e1d571b3406789fb71 but didn't
say how or why they were broken.

3 months agogitlab-ci: Create index.html in documentation deployment
Ben Gamari [Thu, 6 Jun 2019 18:09:53 +0000 (14:09 -0400)] 
gitlab-ci: Create index.html in documentation deployment

Otherwise navigating to will result
in a 404.

3 months agoHadrian: use deb9 Docker images instead of deb8 for CI jobs
Alp Mestanogullari [Wed, 5 Jun 2019 21:40:54 +0000 (23:40 +0200)] 
Hadrian: use deb9 Docker images instead of deb8 for CI jobs

This should fix #16739, where we seem to be getting extra carets in
a test's output because of the gcc that ships with the deb8 image,
whule we're not observing those extra carets in the deb9-based (Make)