6 months agocpp -> ghc
Moritz Angermann [Tue, 12 Mar 2019 04:00:45 +0000 (12:00 +0800)] 
cpp -> ghc

6 months agoMore cleanup
Moritz Angermann [Mon, 11 Mar 2019 04:37:11 +0000 (12:37 +0800)] 
More cleanup

6 months agoMove HC_OPTS into files
Moritz Angermann [Mon, 11 Mar 2019 04:36:54 +0000 (12:36 +0800)] 
Move HC_OPTS into files

6 months agoghc-8.4.4 fixup
Moritz Angermann [Thu, 7 Mar 2019 06:13:56 +0000 (14:13 +0800)] 
ghc-8.4.4 fixup

6 months agodon't regen if it already exists
Moritz Angermann [Thu, 7 Mar 2019 06:01:50 +0000 (14:01 +0800)] 
don't regen if it already exists

6 months agoFix PPC_Darwin
Moritz Angermann [Thu, 7 Mar 2019 02:29:26 +0000 (10:29 +0800)] 
Fix PPC_Darwin

6 months agoWIP
Moritz Angermann [Wed, 6 Mar 2019 15:03:25 +0000 (23:03 +0800)] 

6 months agoFix header locations
Moritz Angermann [Wed, 6 Mar 2019 14:45:06 +0000 (22:45 +0800)] 
Fix header locations

6 months agoMake sure headers are copied properly.
Moritz Angermann [Wed, 6 Mar 2019 13:51:47 +0000 (21:51 +0800)] 
Make sure headers are copied properly.

6 months agodrop stage logic from ghc.cabal
Moritz Angermann [Wed, 6 Mar 2019 09:06:16 +0000 (17:06 +0800)] 
drop stage logic from ghc.cabal

6 months agoMigrate flag logic from ghc to ghc-prim; add HsVersion.h to rts
Moritz Angermann [Wed, 6 Mar 2019 08:35:08 +0000 (16:35 +0800)] 
Migrate flag logic from ghc to ghc-prim; add HsVersion.h to rts

6 months agoMake it build
Moritz Angermann [Wed, 6 Mar 2019 07:24:08 +0000 (15:24 +0800)] 
Make it build

6 months agoWIP
Moritz Angermann [Wed, 6 Mar 2019 01:51:16 +0000 (09:51 +0800)] 

6 months agoSplit Config.hs into Config.hs + config.hs-incl, and place config.hs-incl into the...
Moritz Angermann [Tue, 5 Mar 2019 14:43:47 +0000 (22:43 +0800)] 
Split Config.hs into Config.hs + config.hs-incl, and place config.hs-incl into the rts.

6 months agoMove boot_platform and primops.txt.pp into ghc-prim
Moritz Angermann [Tue, 5 Mar 2019 10:34:26 +0000 (18:34 +0800)] 
Move boot_platform and primops.txt.pp into ghc-prim

6 months agoMove primops into ghc-prim
Moritz Angermann [Tue, 5 Mar 2019 10:26:02 +0000 (18:26 +0800)] 
Move primops into ghc-prim

6 months agoMove Constants into rts
Moritz Angermann [Tue, 5 Mar 2019 10:25:45 +0000 (18:25 +0800)] 
Move Constants into rts

6 months agoBump to 8.6.4 ghc-8.6.4-release
Ben Gamari [Mon, 4 Mar 2019 20:48:49 +0000 (15:48 -0500)] 
Bump to 8.6.4

6 months agogitlab-ci: Drop CircleCI jobs
Ben Gamari [Sat, 2 Mar 2019 20:32:30 +0000 (15:32 -0500)] 
gitlab-ci: Drop CircleCI jobs

6 months agogitlab-ci: Produce DWARF-enabled binary distribution
Ben Gamari [Tue, 19 Feb 2019 16:40:40 +0000 (11:40 -0500)] 
gitlab-ci: Produce DWARF-enabled binary distribution

(cherry picked from commit d298cb9cf722126316c9697c20a8e0048498efb9)

6 months agogitlab-ci: Pull docker images from ghc/ci-images registry
Ben Gamari [Fri, 22 Feb 2019 19:52:50 +0000 (14:52 -0500)] 
gitlab-ci: Pull docker images from ghc/ci-images registry

(cherry picked from commit b90695cdaaa0995c1b7a26289c63be9f9e9cfe3e)

6 months agoFix regression incorrectly advertising TH support ghc-8.6-merges
Herbert Valerio Riedel [Sat, 16 Feb 2019 21:08:46 +0000 (22:08 +0100)] 
Fix regression incorrectly advertising TH support

`--supported-languages` must only advertise language extensions
which are supported by the compiler in order for tooling such
as Cabal relying on this signalling not to behave incorrectly.

Fixes #16331

(cherry picked from commit db4372cda7f6c87e7ad26efe3fca4b3f7f527a48)

6 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)

7 months agousers-guide: Some more release notes for 8.6.4
Ben Gamari [Tue, 12 Feb 2019 18:17:02 +0000 (13:17 -0500)] 
users-guide: Some more release notes for 8.6.4

7 months agoStack: fix name mangling.
Tamar Christina [Sun, 27 Jan 2019 15:54:36 +0000 (15:54 +0000)] 
Stack: fix name mangling.

(cherry picked from commit fb031b9b046e48ffe0d2864ec76bee3bc8ff5625)

7 months agoGhcPlugins: Fix lookup of TH names
Ben Gamari [Sat, 19 Jan 2019 18:59:18 +0000 (13:59 -0500)] 
GhcPlugins: Fix lookup of TH names

Previously `thNameToGhcName` was calling `lookupOrigNameCache` directly, which
failed to handle the case that the name wasn't already in the name cache. This
happens, for instance, when the name was in scope in a plugin being used during
compilation but not in scope in the module being compiled. In this case we the
interface file containing the name won't be loaded and `lookupOrigNameCache`
fails. This was the cause of #16104.

The solution is simple: use the nicely packaged `lookupOrigIO` instead.

(cherry picked from commit 0d9f105ba423af4f2ca215a18d04d4c8e2c372a8)

7 months agotestsuite: Add test for #16104
Ben Gamari [Tue, 15 Jan 2019 16:48:59 +0000 (11:48 -0500)] 
testsuite: Add test for #16104

7 months agotestsuite: Mark ghci063 as broken on Darwin
Ben Gamari [Thu, 17 Jan 2019 18:55:00 +0000 (13:55 -0500)] 
testsuite: Mark ghci063 as broken on Darwin

This is the last failing test on Darwin preventing us from disallowing CI
failures. See #16201.

(cherry picked from commit 0b705fadf936eaf48aaca26d2f7c8c9ae9158c66)

7 months agoBump transformers to
Ben Gamari [Thu, 17 Jan 2019 14:53:23 +0000 (09:53 -0500)] 
Bump transformers to

See #16199.

7 months agoBump process submodule to
Ben Gamari [Thu, 17 Jan 2019 14:50:47 +0000 (09:50 -0500)] 
Bump process submodule to

See #16199

7 months agoFix checkPtrInArena
Ömer Sinan Ağacan [Sat, 12 Jan 2019 13:08:24 +0000 (16:08 +0300)] 
Fix checkPtrInArena

(See comments)

(cherry picked from commit 448f0e7dd78a8d9404f1aa5e8522cc284360c06d)

7 months agoFix raiseAsync() UNDERFLOW_FRAME handling in profiling runtime
Ömer Sinan Ağacan [Thu, 10 Jan 2019 08:55:25 +0000 (11:55 +0300)] 
Fix raiseAsync() UNDERFLOW_FRAME handling in profiling runtime

UNDERFLOW_FRAMEs don't have profiling headers so we have to use the
AP_STACK's function's CCS as the new frame's CCS.

Fixes one of the many bugs caught by concprog001 (#15508).

(cherry picked from commit 74cd4ec5d2f9321aad5db3285cb60d78f2562996)

7 months agoImplement a sanity check for CCS fields in profiling builds
Ömer Sinan Ağacan [Thu, 10 Jan 2019 09:42:04 +0000 (12:42 +0300)] 
Implement a sanity check for CCS fields in profiling builds

This helped me debug one of the bugs in #15508. I'm not sure if this is
a good idea, but it worked for me, so wanted to submit this as a MR.

(cherry picked from commit 82d1a88dec216d761b17252ede760da5c566007f)

7 months agoFix a MSG_BLACKHOLE sanity check, add some comments
Ömer Sinan Ağacan [Mon, 24 Sep 2018 13:21:27 +0000 (16:21 +0300)] 
Fix a MSG_BLACKHOLE sanity check, add some comments

Reviewers: simonmar, bgamari, erikd

Reviewed By: simonmar

Subscribers: rwbarton, carter

GHC Trac Issues: #15508

Differential Revision:

(cherry picked from commit d90946cea1357d3e99805c27dab1e811785a4088)

7 months agorts: Use always-available locking operations in pthread Itimer implementation
Ben Gamari [Wed, 9 Jan 2019 14:17:05 +0000 (09:17 -0500)] 
rts: Use always-available locking operations in pthread Itimer implementation

Previously we ACQUIRE_LOCK and RELEASE_LOCK but these compile to a noop in the
non-threaded RTS, as noted in #16150. Use OS_ACQUIRE_LOCK and OS_RELEASE_LOCK

(cherry picked from commit ce11f6f25c1160262830d9670c4eaaebac37cbaf)

7 months agoitimer: Don't free condvar until we know ticker is stopped
Ben Gamari [Wed, 9 Jan 2019 05:20:19 +0000 (00:20 -0500)] 
itimer: Don't free condvar until we know ticker is stopped

When we are shutting down the pthread ticker we signal the start_cond condition
variable to ensure that the ticker thread wakes up and exits in a reasonable
amount of time. Previously, when the ticker thread would shut down it was
responsible for freeing the start_cond condition variable. However, this would
lead to a race wherein the ticker would free start_cond, then the main thread
would try to signal it in an effort to wake the ticker (#16150).

Avoid this by moving the mutex destruction to the main thread.

(cherry picked from commit 7b12b3f0240321ac1ee43f14eb9c07e015022eeb)

7 months agoFix bogus worker for newtypes
Simon Peyton Jones [Wed, 16 Jan 2019 16:34:24 +0000 (16:34 +0000)] 
Fix bogus worker for newtypes

The "worker" for a newtype is actually a function
with a small (compulsory) unfolding, namely a cast.

But the construction of this function was plain wrong
for newtype /instances/; it cast the arguemnt to the
family type rather than the representation type.

This never actually bit us because, in the case of a
family instance, we immediately cast the result to
the family type.  So we get
   \x. (x |> co1) |> co2

where the compositio of co1 and co2 is ill-kinded.
However the optimiser (even the simple optimiser)
just collapsed those casts, ignoring the mis-match
in the middle, so we never saw the problem.

Trac #16191 is indeed a dup of #16141; but the resaon
these tickets produce Lint errors is not the unnecessary
forcing; it's because of the ill-typed casts.

This patch fixes the ill-typed casts, properly.  I can't
see a way to trigger an actual failure prior to this
patch, but it's still wrong wrong wrong to have ill-typed
casts, so better to get rid of them.

(cherry picked from commit a5373c1fe172dee31e07bcb7c7f6caff1035e6ba)

8 months agoPPC NCG: Implement simple 64-Bit compare on 32-bit
Peter Trommler [Thu, 17 Jan 2019 18:38:21 +0000 (13:38 -0500)] 
PPC NCG: Implement simple 64-Bit compare on 32-bit

8 months agogitlab: Collect artifacts on Windows
Ben Gamari [Wed, 16 Jan 2019 04:21:39 +0000 (23:21 -0500)] 
gitlab: Collect artifacts on Windows

8 months agoRelease notes for 8.6.4 wip/ghc-8.6-backports
Ben Gamari [Thu, 10 Jan 2019 16:40:07 +0000 (11:40 -0500)] 
Release notes for 8.6.4

8 months agoFix recompilation bug with default class methods (#15970)
Simon Marlow [Tue, 11 Dec 2018 18:18:47 +0000 (13:18 -0500)] 
Fix recompilation bug with default class methods (#15970)

If a module uses a class, then it can instantiate the class and
thereby use its default methods, so we must include the default
methods when calculating the fingerprint for the class.

Test Plan:
New unit test: driver/T15970


=====> T15970(normal) 1 of 1 [0, 0, 0]
cd "" && $MAKE -s --no-print-directory T15970
Wrong exit code for T15970()(expected 0 , actual 2 )
Stdout ( T15970 ):
Makefile:13: recipe for target 'T15970' failed
Stderr ( T15970 ):
C.o:function Main_zdfTypeClassMyDataType1_info: error: undefined
reference to 'A_toTypedData2_closure'
C.o:function Main_main1_info: error: undefined reference to
C.o(.data+0x298): error: undefined reference to 'A_toTypedData2_closure'
C.o(.data+0x480): error: undefined reference to 'A_toTypedData2_closure'
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)

After: test passes.

Reviewers: bgamari, simonpj, erikd, watashi, afarmer

Subscribers: rwbarton, carter

GHC Trac Issues: #15970

Differential Revision:

(cherry picked from commit 288f681e06accbae690c46eb8a6e997fa9e5f56a)

8 months agotestsuite: Mark objcpp-hi and T13366 as broken on Darwin due to #16083
Ben Gamari [Sat, 22 Dec 2018 15:01:46 +0000 (10:01 -0500)] 
testsuite: Mark objcpp-hi and T13366 as broken on Darwin due to #16083

(cherry picked from commit 1c0c5e844226f3d77af31d97b21ffb8b14b55740)

8 months agotestsuite: Mark heapprof001 as broken in prof_hc_hb way on i386
Ben Gamari [Sat, 22 Dec 2018 18:02:08 +0000 (13:02 -0500)] 
testsuite: Mark heapprof001 as broken in prof_hc_hb way on i386

As documented in #15382, this is known to fail in prof_hc_hb on i386.
Concerningly, I have also seen this test non-deterministically fail in
prof_hc_hb on amd64. We should really investigate this.

(cherry picked from commit 8fd3f9a67f9c7b447a5bfcb3aefd8986794918ce)

8 months agogitlab-ci: Allow integer-simple and unregisterised builds to fail
Ben Gamari [Sat, 29 Dec 2018 21:35:44 +0000 (16:35 -0500)] 
gitlab-ci: Allow integer-simple and unregisterised builds to fail

8 months agotestsuite: Skip ffi018_ghci when unregisterised
Ben Gamari [Tue, 25 Dec 2018 10:03:21 +0000 (05:03 -0500)] 
testsuite: Skip ffi018_ghci when unregisterised

As noted in #16085 this test is fragile in unregisterised compilers.

(cherry picked from commit 7bfc1e81377d1e37069cf52bd090530124dcd871)

8 months agogitlab-ci: Skip performance tests
Ben Gamari [Thu, 27 Dec 2018 15:26:43 +0000 (10:26 -0500)] 
gitlab-ci: Skip performance tests

These are just too fragile on ghc-8.6 which lacks #12758.

8 months agoGrab CI configuration from master
Ben Gamari [Wed, 26 Dec 2018 17:01:10 +0000 (12:01 -0500)] 
Grab CI configuration from master

This is awfully ugly but is nevertheless significantly less error-prone
than cherry-picking all of the relevant commits manually.

8 months agoRevert "Windows: Use the "big" PE object format on amd64"
Ben Gamari [Mon, 24 Dec 2018 01:09:30 +0000 (20:09 -0500)] 
Revert "Windows: Use the "big" PE object format on amd64"

This ended up breaking GHCi due to alignment issues. See #16071.

This reverts commit ed86e3b531322f74d2c2d00d7ff8662b08fabde6.

9 months agoutils/gen-dll: Bump containers upper bound
Ben Gamari [Sun, 9 Dec 2018 20:28:52 +0000 (15:28 -0500)] 
utils/gen-dll: Bump containers upper bound

Fixes #16023.

(cherry picked from commit e709c8f8d45c699840f5bab7c9ff71373a53b8b0)

9 months agoRelease 8.6.3 ghc-8.6.3-release
Ben Gamari [Thu, 6 Dec 2018 21:58:34 +0000 (16:58 -0500)] 
Release 8.6.3

9 months agousers guide: Add release notes for 8.6.3
Ben Gamari [Thu, 6 Dec 2018 21:57:16 +0000 (16:57 -0500)] 
users guide: Add release notes for 8.6.3

9 months agoWindows: Use the "big" PE object format on amd64
Ben Gamari [Thu, 6 Dec 2018 20:28:47 +0000 (15:28 -0500)] 
Windows: Use the "big" PE object format on amd64

Test Plan: Do full build on Windows.

Reviewers: AndreasK, Phyx

Reviewed By: AndreasK

Subscribers: rwbarton, erikd, carter

GHC Trac Issues: #15934

Differential Revision:

(cherry picked from commit 1ef90f990da90036d481c830d8832e21b8f1571b)

9 months agolinker: store entire link map and use it.
Tamar Christina [Tue, 4 Dec 2018 00:29:08 +0000 (00:29 +0000)] 
linker: store entire link map and use it.

This fixes a corner case in which we have seen the symbol multiple times in
different static libraries, but due to a depencency we end up loading the
symbol from a library other than the first one.

Previously the runtime linker would only track symbols from the first
library and did not store the full link map.  In this case it was unable
to find the address for the symbols in the second library during delay

This change stores the address of all symbols seen so a full link map
is generated, such that when we make a different decision later than what
was expected we're able to still correctly load the library.

Test Plan: ./validate, new testcase T15894

Reviewers: angerman, bgamari, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, carter

GHC Trac Issues: #15894

Differential Revision:

(cherry picked from commit a8b7cef4d45a5003bf7584e06912f0f632116c71)

9 months agoBump iserv versions
Ben Gamari [Thu, 6 Dec 2018 17:43:28 +0000 (12:43 -0500)] 
Bump iserv versions

This fixes #15866, the original fix for which didn't merge cleanly to
the stable branch.

9 months agoRemove explicit recursion in retainer profiling (fixes #14758)
Alexander Vershilov [Wed, 5 Dec 2018 16:47:32 +0000 (19:47 +0300)] 
Remove explicit recursion in retainer profiling (fixes #14758)

Retainer profiling contained a recursion that under
certain circumstances could lead to the stack overflow
in C code.

The idea of the improvement is to keep an explicit stack for the
object, more precise to reuse existing stack, but allow new type of
objects to be stored there.

There is no reliable reproducer that is not a big program
but in some cases foldr (+) 0 [1..10000000] can work.

Reviewers: bgamari, simonmar, erikd, osa1

Reviewed By: bgamari, osa1

Subscribers: osa1, rwbarton, carter

GHC Trac Issues: #14758

Differential Revision:

(cherry picked from commit 5f1d949ab9e09b8d95319633854b7959df06eb58)

9 months agoFix #15859 by checking, not assuming, an ArgFlag
Richard Eisenberg [Mon, 5 Nov 2018 16:01:47 +0000 (11:01 -0500)] 
Fix #15859 by checking, not assuming, an ArgFlag

We thought that visible dependent quantification was impossible
in terms, but Iceland Jack discovered otherwise in #15859. This fixes an
ASSERT failure that arose.

test case: dependent/should_fail/T15859

(cherry picked from commit 72b82343b79365dc74ffafb345dd33499a7fd394)

(cherry picked from commit 5693ddd071033516a1804420a903cb7e3677682b)

9 months agobase: Mention openFile throwing does-not-exist-errors on FIFOs
Ben Gamari [Thu, 22 Nov 2018 16:33:39 +0000 (11:33 -0500)] 
base: Mention openFile throwing does-not-exist-errors on FIFOs

As discussed in #15715, the POSIX specification specifies that
attempting to open a FIFO in write-only mode when the FIFO has no
readers will fail with -ENOENT.

[skip ci]

Test Plan: Read it

Reviewers: hvr

Subscribers: rwbarton, carter

GHC Trac Issues: #15715

Differential Revision:

(cherry picked from commit 4ba3fa31ddfa12b428bd67216a2d4118dc9e8311)

9 months agoRevert "libiserv: Generate cabal file with autoconf"
Ben Gamari [Thu, 22 Nov 2018 21:59:14 +0000 (16:59 -0500)] 
Revert "libiserv: Generate cabal file with autoconf"

This reverts commit cbde2726f10b8f4c19483bbb755ad42356098c51.

9 months agorts/MachO: Iterate through N (all) symbols, not M external symbols
Dario Bertini [Fri, 16 Nov 2018 14:49:37 +0000 (15:49 +0100)] 
rts/MachO: Iterate through N (all) symbols, not M external symbols

Fixes #15105

(cherry picked from commit 254890855ee04762cc0392da19e0c42fc039a718)

9 months agorts/MachO: A bit of refactoring in ocGetNames
Dario Bertini [Fri, 16 Nov 2018 14:48:36 +0000 (15:48 +0100)] 
rts/MachO: A bit of refactoring in ocGetNames

Eliminates a bit of repetition.

(cherry picked from commit b2f6f896a0bae0e68ec629bd6817a2cb2533a12c)

9 months agorts/MachO: Add a bit more debugging output to getNames
Dario Bertini [Fri, 16 Nov 2018 14:46:54 +0000 (15:46 +0100)] 
rts/MachO: Add a bit more debugging output to getNames

(cherry picked from commit 9e0a23b95c285c4019fd2d36102374ee582f1dcb)

9 months agocircleci: Actually build with in-tree GMP on Darwin
Dario Bertini [Fri, 16 Nov 2018 09:25:32 +0000 (10:25 +0100)] 
circleci: Actually build with in-tree GMP on Darwin

Fixes #15404.

(cherry picked from commit 3584bd4255eb59be043252c9b4ef16bcbd835c9b)

9 months agoFix a bug in SRT generation (#15892)
Simon Marlow [Thu, 15 Nov 2018 03:31:35 +0000 (06:31 +0300)] 
Fix a bug in SRT generation (#15892)

The logic in `Note [recursive SRTs]` was correct. However, my
implementation of it wasn't: I got the associativity of
`Set.difference` wrong, which led to an extremely subtle and difficult
to find bug.

Fortunately now we have a test case. I was able to cut down the code
to something manageable, and I've added it to the test suite.

Test Plan:
Before (using my stage 1 compiler without the fix):

====> T15892(normal) 1 of 1 [0, 0, 0]
cd "" &&  "/home/smarlow/ghc/inplace/bin/ghc-stage1" -o T15892
T15892.hs -dcore-lint -dcmm-lint -no-user-package-db -rtsopts
-fno-warn-missed-specialisations -fshow-warning-groups
-fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat
-dno-debug-output  -O
cd "" && ./T15892  +RTS -G1 -A32k -RTS
Wrong exit code for T15892(normal)(expected 0 , actual 134 )
Stderr ( T15892 ):
T15892: internal error: evacuate: strange closure type 0
    (GHC version 8.7.20181113 for x86_64_unknown_linux)
    Please report this as a GHC bug:
Aborted (core dumped)
*** unexpected failure for T15892(normal)
=====> T15892(g1) 1 of 1 [0, 1, 0]
cd "" &&  "/home/smarlow/ghc/inplace/bin/ghc-stage1" -o T15892
T15892.hs -dcore-lint -dcmm-lint -no-user-package-db -rtsopts
-fno-warn-missed-specialisations -fshow-warning-groups
-fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat
-dno-debug-output  -O
cd "" && ./T15892 +RTS -G1 -RTS +RTS -G1 -A32k -RTS
Wrong exit code for T15892(g1)(expected 0 , actual 134 )
Stderr ( T15892 ):
T15892: internal error: evacuate: strange closure type 0
    (GHC version 8.7.20181113 for x86_64_unknown_linux)
    Please report this as a GHC bug:
Aborted (core dumped)

After (using my stage 2 compiler with the fix):

=====> T15892(normal) 1 of 1 [0, 0, 0]
cd "" &&  "/home/smarlow/ghc/inplace/test   spaces/ghc-stage2"
-o T15892 T15892.hs -dcore-lint -dcmm-lint -no-user-package-db -rtsopts
-fno-warn-missed-specialisations -fshow-warning-groups
-fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat
cd "" && ./T15892  +RTS -G1 -A32k -RTS
=====> T15892(g1) 1 of 1 [0, 0, 0]
cd "" &&  "/home/smarlow/ghc/inplace/test   spaces/ghc-stage2"
-o T15892 T15892.hs -dcore-lint -dcmm-lint -no-user-package-db -rtsopts
-fno-warn-missed-specialisations -fshow-warning-groups
-fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat
cd "" && ./T15892 +RTS -G1 -RTS +RTS -G1 -A32k -RTS

Reviewers: bgamari, osa1, erikd

Reviewed By: osa1

Subscribers: rwbarton, carter

GHC Trac Issues: #15892

Differential Revision:

9 months agoLoad plugins in interactive session
Christiaan Baaij [Thu, 22 Nov 2018 16:50:51 +0000 (11:50 -0500)] 
Load plugins in interactive session

Reviewers: bgamari, tdammers

Reviewed By: tdammers

Subscribers: monoidal, rwbarton, carter

GHC Trac Issues: #15633

Differential Revision:

(cherry picked from commit 599eaada382d04722219bfc319bde94591be3fb1)

9 months agorts/M32Alloc: Abort if m32 linker mmap fails
Ben Gamari [Sat, 10 Nov 2018 20:35:37 +0000 (15:35 -0500)] 
rts/M32Alloc: Abort if m32 linker mmap fails

Previously we should just blinding dereference a NULL pointer.

(cherry picked from commit 86f6890e3689f2f75ecca8172eda0338fe3e9769)

9 months agousers guide: We no longer build libraries with -split-objs
Ben Gamari [Thu, 22 Nov 2018 00:17:41 +0000 (19:17 -0500)] 
users guide: We no longer build libraries with -split-objs

We now generally use split-sections instead.

(cherry picked from commit f5fbecc85967218fd8ba6512f10eea2daf2812ac)

9 months agoFix heap corruption during stable name allocation
Ömer Sinan Ağacan [Wed, 21 Nov 2018 17:03:38 +0000 (20:03 +0300)] 
Fix heap corruption during stable name allocation

See #15906 for the problem. To fix we simply call `allocate()` instead of
`ALLOC_PRIM()`. `allocate()` does not trigger GC when the nursery is full,
instead it extends it.

Test Plan:
This validates. memo001 now passes with `-debug` compile parameter. I'll add
another test that runs memo001 with `-debug` once I figure out how to use
stdout files for multiple tests.

Reviewers: simonmar, bgamari, erikd

Reviewed By: simonmar

Subscribers: rwbarton, carter

GHC Trac Issues: #15906

Differential Revision:

(cherry picked from commit 691aa715cf43bf9d88ee32bca37e471bae35adfb)

10 months agodistrib/configure: Set RanlibCmd
Ben Gamari [Thu, 8 Nov 2018 02:02:19 +0000 (21:02 -0500)] 
distrib/configure: Set RanlibCmd

This fixes #15875.

10 months agolibiserv: Generate cabal file with autoconf
Ben Gamari [Tue, 6 Nov 2018 15:33:01 +0000 (10:33 -0500)] 
libiserv: Generate cabal file with autoconf

Previously the version number was set by hand. This seems like
unnecessary busywork for what is mostly an internal library.

10 months agoSet RELEASE=NO
Ben Gamari [Mon, 5 Nov 2018 16:47:11 +0000 (11:47 -0500)] 

10 months agointeger-gmp: Fix TBA in changelog
Ben Gamari [Fri, 2 Nov 2018 15:48:05 +0000 (11:48 -0400)] 
integer-gmp: Fix TBA in changelog

10 months agoDon't lint erroneous programs. ghc-8.6.2-release
Richard Eisenberg [Thu, 1 Nov 2018 22:03:21 +0000 (18:03 -0400)] 
Don't lint erroneous programs.

newFamInst lints its types. This is good. But it's not so good
when there have been errors and thus recovery tycons are about.
So we now don't.

Fixes #15796.

Test case: typecheck/should_fail/T15796

(cherry picked from commit 1f72a1c81368e34387aac38c0b1c59521cec58ec)

10 months agoFix #15787 by squashing a coercion hole.
Richard Eisenberg [Sun, 28 Oct 2018 20:06:17 +0000 (16:06 -0400)] 
Fix #15787 by squashing a coercion hole.

In type-incorrect code, we can sometimes let a coercion
hole make it through the zonker. If this coercion hole then
ends up in the environment (e.g., in the type of a data
constructor), then it causes trouble later.

This patch avoids trouble by substituting the coercion hole
for its representative CoVar. Really, any coercion would do,
but the CoVar was very handy.

test case: polykinds/T15787

(cherry picked from commit 4427315a65b25db22e1754d41b43dd4b782b022f)

10 months agousers-guide: Fix version number
Ben Gamari [Wed, 31 Oct 2018 16:23:39 +0000 (12:23 -0400)] 
users-guide: Fix version number

10 months agousers-guide: Note existence of #14251
Ben Gamari [Tue, 30 Oct 2018 18:13:22 +0000 (14:13 -0400)] 
users-guide: Note existence of #14251

10 months agoFix #15815 by parenthesizing the arguments to infix ~
Ryan Scott [Sun, 28 Oct 2018 20:08:11 +0000 (16:08 -0400)] 
Fix #15815 by parenthesizing the arguments to infix ~

An unfortunate consequence of commit
b9483981d128f55d8dae3f434f49fa6b5b30c779 (`Remove HsEqTy and XEqTy`)
is infix uses of `~` in TH quotes now desugar differently than
before. In particular, we have that:

a ~ (Int -> Int)

Now desugars to:

HsOpTy a (~) (HsOpTy Int (->) Int)

Which GHC interprets as being:

a ~ Int -> Int

Or, equivalently:

(a ~ Int) -> Int

Which is different than what was intended! This is the cause
of #15815.

All of this has revealed that we likely need to renovate the way we
desugar infix type operators to be more consistent with the treatment
for infix expressions (see for more on
this.) Doing so would constitute a breaking change, however, so we
will likely want to wait until another major GHC release to do this.

In the meantime, this patch offers a non-invasive change to the way
that infix uses of `~` are desugared. This makes the program
in #15815 compile again by inserting extra `HsParTy`s around the
arguments to `~` if they are lacking them.

Test Plan: make test TEST=T15815

Reviewers: int-index, goldfire, bgamari

Reviewed By: int-index

Subscribers: int-e, rwbarton, carter

GHC Trac Issues: #15815

Differential Revision:

(cherry picked from commit b8a797ecc34a309bd78f5a290e3554642a3a478a)

10 months agoRevert "Multiple fixes / improvements for LLVM backend"
Ben Gamari [Tue, 30 Oct 2018 15:12:46 +0000 (11:12 -0400)] 
Revert "Multiple fixes / improvements for LLVM backend"

This reverts commit 73273be476a8cc6c13368660b042b3b0614fd928.

Unfortunately we were unable to come to a fix that didn't sacrifice the
ability to bootstrap GHC using the LLVM backend. Reverting for 8.6.2.

10 months agoRevert "Fix for T14251 on ARM"
Ben Gamari [Tue, 30 Oct 2018 15:12:12 +0000 (11:12 -0400)] 
Revert "Fix for T14251 on ARM"

This reverts commit 2e23e1c7de01c92b038e55ce53d11bf9db993dd4.

10 months agousers-guide: Fix typo
Ben Gamari [Mon, 29 Oct 2018 17:56:40 +0000 (13:56 -0400)] 
users-guide: Fix typo

10 months agoReport a Wanted error even if there are Given ones
Simon Peyton Jones [Thu, 18 Oct 2018 14:41:44 +0000 (15:41 +0100)] 
Report a Wanted error even if there are Given ones

We suppress some Given errors; see Note [Given errors]
in TcErrors.  But we must be careful not to suppress
Wanted errors because of the presence of these Given
errors -- else we might allow compilation to bogusly

The rubber hits the road in TcRnTypes.insolubleCt,
where we don't want to treat Givens as insoluble,
nor (and this is the new bit) Deriveds that arise
from Givens.  See Note [Given insolubles] in TcRnTypes.

This fixes #15767.

(cherry picked from commit 6b1102e2cfcffb265fd33cf8a99ab5e6b3f14906)

Ben notes:

  I have folded some test output changes in `TEST="T12529 T12921 mc13
  mc14"` into this patch that were not in the original.

10 months agoFix TcType.anyRewritableTyVar
Ningning Xie [Sun, 28 Oct 2018 16:29:55 +0000 (12:29 -0400)] 
Fix TcType.anyRewritableTyVar

This patch fixes #15805, where we found that
`TcType.anyRewritableTyVar` has one wrong case.

Besides the fix, it also:
- removed some unnecessary `ASSERT2(tcIsTcTyVar...)` in `TcType`, as now we have
     `tcIsTcTyVar = isTyVar`.
- fixed some comments

Test Plan: ./validate

Reviewers: goldfire, simonpj, bgamari

Reviewed By: simonpj

Subscribers: rwbarton, carter

GHC Trac Issues: #15805

Differential Revision:

(cherry picked from commit a7f64c6cbfc5562adff207945576d1c9db2a58d9)

10 months agousers-guide: Add release notes for 8.6.2
Ben Gamari [Sun, 28 Oct 2018 20:02:51 +0000 (16:02 -0400)] 
users-guide: Add release notes for 8.6.2

10 months agoplugins: search for .a files if necessary
sheaf [Sun, 28 Oct 2018 16:30:13 +0000 (12:30 -0400)] 
plugins: search for .a files if necessary

on windows, plugins are loaded via .a files,
but those paths were not being searched when loading plugins

Test Plan: ./validate

Reviewers: Phyx, bgamari

Reviewed By: Phyx

Subscribers: RyanGlScott, rwbarton, carter

GHC Trac Issues: #15700

Differential Revision:

(cherry picked from commit 70298db16c3f0ea4adb603ccb2b5e93eb9c7a556)

10 months agoComment out CONSTANT_FOLDED in GHC.Natural
Christiaan Baaij [Sun, 28 Oct 2018 16:29:23 +0000 (12:29 -0400)] 
Comment out CONSTANT_FOLDED in GHC.Natural

Although these functions were marked as CONSTANT_FOLDED, they did
not have a corresponding builtinRule in PrelRules. The idea was
probably to add them eventually, but this hasn't manifested so

The plan is to eventually add builtin rules for these functions
over Natural, so as a reminder we simply comment out the
CONSTANT_FOLDED  annotation instead of removing it completely.

Reviewers: hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, carter

Differential Revision:

(cherry picked from commit 3ec6fe8827956cc36b58cdf0bb1f5752eaa2a8ea)

10 months agoFix integer overflow when encoding doubles (Trac #15271)
Fangyi Zhou [Sun, 28 Oct 2018 16:28:53 +0000 (12:28 -0400)] 
Fix integer overflow when encoding doubles (Trac #15271)

Ticket #15271 reports a case where 1e1000000000 is incorrectly
converted to 0.0. After some investigation, I discovered the number is
converted to rational correctly, but converting the ratio into a double
introduced an error.

Tracking down to how the conversion is done, I found the rts float
implementation uses `ldexp`, whose signature is
`double ldexp (double x, int exp);`
The callsite passes an `I_` to the second argument, which is
platform-dependent. On machines where `I_` is 64 bits and `int` is 32 bits, we
observe integer overflow behaviour.

Here is a mapping from rational to exponent with observations
1e646457008  -> 2147483645 (result = infinity, positive in int32)
1e646457009  -> 2147483648 (result = 0.0, overflow to negative in int32)
1e1000000000 -> 3321928042 (result = infinity, overflow to positive in int32)
1e1555550000 -> 5167425196 (result = 0.0, overflow to negative in int32)

We fix this issue by comparing STG_INT_MIN/MAX and INT_MIN/MAX and bound the
value appropriately.

Test Plan: New test cases

Reviewers: bgamari, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, carter

GHC Trac Issues: #15271

Differential Revision:

(cherry picked from commit 311a63979cfa2c1e81be54b82205e681f6ec4f14)

10 months agoFix `:k` command: add validity checking
Ningning Xie [Sun, 28 Oct 2018 16:26:12 +0000 (12:26 -0400)] 
Fix `:k` command: add validity checking

This patch fixes #15806, where we found that the `:k` command in GHCi
misses a validity checking for the type.

Missing validity checking causes `:k` to accept types that are not validated.
For example, `:k (Maybe (forall a. a -> a))` (incorrectly) returns `*`, while
impredictivity of type instantiation shouldn't be allowed.

Test Plan: ./validate

Reviewers: simonpj, goldfire, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, carter

GHC Trac Issues: #15806

Differential Revision:

(cherry picked from commit 12cb5cf50b8b35394e2e2d57e1ac693c76f90833)

10 months agoincludes: Allow headers to be built with C++11 compilers
Ben Gamari [Sun, 28 Oct 2018 16:24:06 +0000 (12:24 -0400)] 
includes: Allow headers to be built with C++11 compilers

Fixes #14784. Note that C++11 is quite conservative; we could likely accept
C++03 as well.

Test Plan:
$ cat >hi.c <<EOF
#include <Rts.h>
$ g++ -std=c++11 hi.c

Reviewers: simonmar, hvr

Subscribers: rwbarton, carter

GHC Trac Issues: #14784

Differential Revision:

(cherry picked from commit d3a1022fabb0ad337003fac774c6929f402ecb8b)

10 months agoFix rare undefined asm temp end label error in x86
Zejun Wu [Sun, 28 Oct 2018 16:22:25 +0000 (12:22 -0400)] 
Fix rare undefined asm temp end label error in x86

Encountered assembly error due to undefined label `.LcaDcU_info_end` for
following code generated by `pprFrameProc`:

  .long .Lblock{v caDcU}_info_fde_end-.Lblock{v caDcU}_info_fde
.Lblock{v caDcU}_info_fde:
  .long _nbHlD-.Lsection_frame
  .quad block{v caDcU}_info-1
  .quad .Lblock{v caDcU}_info_end-block{v caDcU}_info+1
  .byte 1

This diff fixed the error.

Test Plan:

Also the case where we used to have assembly error is now fixed.
Unfortunately, I have limited insight here and cannot get a small enough repro
or test case for this.

Ben says:

> I think I see: Previously we only produced end symbols for the info
> tables of top-level procedures. However, blocks within a procedure may
> also have info tables, we will dutifully generate debug information for
> and consequently we get undefined symbols.

Reviewers: simonmar, scpmw, last_g, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, carter

Differential Revision:

(cherry picked from commit cf961dcf5ebc26cbd960196ba387736334088303)

10 months agoFix for T14251 on ARM
Kavon Farvardin [Sun, 28 Oct 2018 16:11:49 +0000 (12:11 -0400)] 
Fix for T14251 on ARM

We now calculate the SSE register padding needed to fix the calling
convention in LLVM in a robust way: grouping them by whether
registers in that class overlap (with the same class overlapping

My prior patch assumed that no matter the platform, physical
register Fx aliases with Dx, etc, for our calling convention.

This is unfortunately not the case for any platform except x86-64.

Test Plan:
Only know how to test on x86-64, but it should be tested on ARM with:

`make test WAYS=llvm && make test WAYS=optllvm`

Reviewers: bgamari, angerman

Reviewed By: bgamari

Subscribers: rwbarton, carter

GHC Trac Issues: #15780, #14251, #15747

Differential Revision:

(cherry picked from commit c36a2b596a6ba9d7a0a80df01b3c041720c727ca)

10 months agoBump hsc2hs submodule
Ben Gamari [Thu, 18 Oct 2018 13:17:53 +0000 (09:17 -0400)] 
Bump hsc2hs submodule

11 months agoBump version to 8.6.2
Ben Gamari [Wed, 17 Oct 2018 22:39:25 +0000 (18:39 -0400)] 
Bump version to 8.6.2

11 months agocircleci: Build with in-tree GMP on Darwin
Ben Gamari [Wed, 17 Oct 2018 19:31:36 +0000 (15:31 -0400)] 
circleci: Build with in-tree GMP on Darwin

Fixes #15404.

11 months agoFix #15761 by adding parens
Richard Eisenberg [Wed, 17 Oct 2018 14:46:21 +0000 (10:46 -0400)] 
Fix #15761 by adding parens

This was just a pretty-printer infelicity. Fixed now.

Test case: printer/T15761

(cherry picked from commit 38c28c1a8bb129141e533866700e7318314f32c1)

11 months agoBump haddock submodule
Ben Gamari [Wed, 17 Oct 2018 15:19:53 +0000 (11:19 -0400)] 
Bump haddock submodule

11 months agoFail fast on pattern synonyms
Simon Peyton Jones [Wed, 3 Oct 2018 14:53:59 +0000 (15:53 +0100)] 
Fail fast on pattern synonyms

We were recovering too eagerly from errors in pattern-synonym
type inference, leading to a cascade of confusing follow up errors
(Trac #15685, #15692).

The underlying issue is that a pattern synonym should have a closed,
fixed type, with no unification variables in it.  But it wasn't!

Fixing this made me change the interface to simplifyInfer slightly.
Instead of /emitting/ a residual implication constraint, it
now /returns/ it, so that the caller can decide what to do.

(cherry picked from commit 9ebfa03d9e9cbf79f698b5d4bd39e799e4e9a02c)

11 months agobase: Fill in TBAs in changelog
Ben Gamari [Mon, 15 Oct 2018 17:59:20 +0000 (13:59 -0400)] 
base: Fill in TBAs in changelog

I've added a check in my release script to ensure that this doesn't happen in
the future.

(cherry picked from commit 2605458930f2d79738fab4437f10793448d4232c)

11 months agoFix dataToTag# argument evaluation
Ömer Sinan Ağacan [Wed, 10 Oct 2018 07:07:05 +0000 (10:07 +0300)] 
Fix dataToTag# argument evaluation

See #15696 for more details. We now always enter dataToTag# argument (done in
generated Cmm, in StgCmmExpr). Any high-level optimisations on dataToTag#
applications are done by the simplifier. Looking at tag bits (instead of
reading the info table) for small types is left to another diff.

Incorrect test T14626 is removed. We no longer do this optimisation (see
comment:44, comment:45, comment:60).

Comments and notes about special cases around dataToTag# are removed. We no
longer have any special cases around it in Core.

Other changes related to evaluating primops (seq# and dataToTag#) will be
pursued in follow-up diffs.

Test Plan: Validates with three regression tests

Reviewers: simonpj, simonmar, hvr, bgamari, dfeuer

Reviewed By: simonmar

Subscribers: rwbarton, carter

GHC Trac Issues: #15696

Differential Revision:

(cherry picked from commit ac977688523e5d77eb6f041f043552410b0c21da)

11 months agoDo not mark CoVars as dead in the occur-anal
Simon Peyton Jones [Wed, 3 Oct 2018 14:41:43 +0000 (15:41 +0100)] 
Do not mark CoVars as dead in the occur-anal

For years we have been marking CoVars as dead, becuase we
don't gather occurrence info from types.  This is obviously
wrong and caused Trac #15695.

See Note [Do not mark CoVars as dead] in OccurAnal.

(cherry picked from commit 02b303eed0170983921877801e57f55d012db301)

11 months agoFix for recover with -fexternal-interpreter (#15418)
Simon Marlow [Wed, 26 Sep 2018 20:32:29 +0000 (15:32 -0500)] 
Fix for recover with -fexternal-interpreter (#15418)

When using -fexternal-interpreter, recover was not treating a Q
compuation that simply registered an error with addErrTc as failing.

Test Plan:
New unit tests:
* T15418 is the repro from in the ticket
* TH_recover_warns is a new test to ensure that we're keeping warnings when
  the body of recover succeeds.

Reviewers: bgamari, RyanGlScott, angerman, goldfire, erikd

Subscribers: rwbarton, carter

GHC Trac Issues: #15418

Differential Revision:

(cherry picked from commit d00c308633fe7d216d31a1087e00e63532d87d6d)

11 months agoGHCi should not filter instances involving cTuples
Alec Theriault [Tue, 2 Oct 2018 12:48:00 +0000 (14:48 +0200)] 
GHCi should not filter instances involving cTuples

Summary: See the new T12005 test case for an example of this.

Test Plan: make TEST=T12005

Reviewers: bgamari, osa1

Reviewed By: osa1

Subscribers: osa1, rwbarton, carter

GHC Trac Issues: #12005

Differential Revision:

(cherry picked from commit 21efbc7599e39ec93b8b13b7d7b84811226e6f6f)