ghc.git
16 months agoExpand $tooldir in ghc --info output
Alp Mestanogullari [Sat, 12 May 2018 07:36:19 +0000 (08:36 +0100)] 
Expand $tooldir in ghc --info output

Summary:
This requires adding an `sToolDir :: Maybe FilePath` field to Settings, since
compilerInfo is pure and therefore needs to have all the information
available in the DynFlags.

This should fix #15101 and #15107.

Test Plan: ./validate --fast

Reviewers: Phyx, bgamari

Reviewed By: Phyx

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15101, #15107

Differential Revision: https://phabricator.haskell.org/D4686

16 months agoFix unwinding of C -> Haskell FFI calls with -threaded
Bartosz Nitka [Thu, 3 May 2018 17:43:38 +0000 (10:43 -0700)] 
Fix unwinding of C -> Haskell FFI calls with -threaded

See the new note.

Test Plan:
manual testing with patched gdb

Reviewers: bgamari, simonmar, erikd

Subscribers: rwbarton, thomie, carter

Differential Revision: https://phabricator.haskell.org/D4666

16 months agoBlockAlloc.c: reuse tail_of function
Ömer Sinan Ağacan [Fri, 11 May 2018 07:24:00 +0000 (10:24 +0300)] 
BlockAlloc.c: reuse tail_of function

16 months agoRevert "Add -fghci-leak-check to check for space leaks"
Simon Marlow [Thu, 10 May 2018 16:39:53 +0000 (17:39 +0100)] 
Revert "Add -fghci-leak-check to check for space leaks"

This reverts commit 5fe6aaa3756cda654374ebfd883fa8f064ff64a4.

16 months agorts: remove unused round_up_to_mblocks function
Ömer Sinan Ağacan [Thu, 10 May 2018 15:05:51 +0000 (18:05 +0300)] 
rts: remove unused round_up_to_mblocks function

16 months agoFix #15038
Ömer Sinan Ağacan [Thu, 10 May 2018 08:13:37 +0000 (11:13 +0300)] 
Fix #15038

We introduce a new Id for unused pointer values in unboxed sums that is
not CAFFY. Because the Id is not CAFFY it doesn't make non-CAFFY
definitions CAFFY, fixing #15038.

To make sure anything referenced by the new id will be retained we get a
stable pointer to in on RTS startup.

Test Plan: Passes validate

Reviewers: simonmar, simonpj, hvr, bgamari, erikd

Reviewed By: simonmar

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15038

Differential Revision: https://phabricator.haskell.org/D4680

16 months agoAdd -fghci-leak-check to check for space leaks
Simon Marlow [Wed, 2 May 2018 10:01:13 +0000 (11:01 +0100)] 
Add -fghci-leak-check to check for space leaks

Summary:
Space leaks in GHCi emerge from time to time and tend to come back again
after they get fixed. This is an attempt to limit regressions by

* adding a reliable detection for some classes of space leaks in GHCi
* turning on leak checking for all GHCi tests in the test suite, so that
  we'll notice if the leak appears again.

The idea for detecting space leaks is quite simple:

* find some data that we expect to be GC'd later, make a weak pointer to it
* when we expect the data to be dead, do a `performGC` and then check
  the status of the weak pointer.

It would be nice to apply this trick to lots of things in GHC,
e.g. ensuring that HsSyn is not retained after the desugarer, or
ensuring that CoreSyn from the previous simplifier pass is not retained.

Test Plan: validate

Reviewers: bgamari, simonpj, erikd, niteria

Subscribers: thomie, carter

GHC Trac Issues: #15111

Differential Revision: https://phabricator.haskell.org/D4658

16 months agoNormalize the element type of ListPat, fix #14547
HE, Tao [Tue, 8 May 2018 14:53:41 +0000 (10:53 -0400)] 
Normalize the element type of ListPat, fix #14547

Summary:
The element type of `List` maybe a type family instacen, rather than a trivial type.
For example in Trac #14547,

```
{-# LANGUAGE TypeFamilies, OverloadedLists #-}

class Foo f where
        type It f
        foo :: [It f] -> f

data List a = Empty | a :! List a deriving Show

instance Foo (List a) where
        type It (List a) = a
        foo [] = Empty
        foo (x : xs) = x :! foo xs
```

Here the element type of `[]` is `It (List a)`, we should also normalize
it as `a`.

Test Plan: make test TEST="T14547"

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #14547

Differential Revision: https://phabricator.haskell.org/D4624

16 months agoRevert "Normalize the element type of ListPat, fix #14547"
Ben Gamari [Tue, 8 May 2018 14:52:28 +0000 (10:52 -0400)] 
Revert "Normalize the element type of ListPat, fix #14547"

This reverts commit 981bf4718de7daef7817a363ccc14030c2688632.

16 months agoNormalize the element type of ListPat, fix #14547
Ben Gamari [Tue, 8 May 2018 14:08:04 +0000 (10:08 -0400)] 
Normalize the element type of ListPat, fix #14547

The element type of `List` maybe a type family instacen, rather than a
trivial type.
For example in Trac #14547,

```
{-# LANGUAGE TypeFamilies, OverloadedLists #-}

class Foo f where
        type It f
        foo :: [It f] -> f

data List a = Empty | a :! List a deriving Show

instance Foo (List a) where
        type It (List a) = a
        foo [] = Empty
        foo (x : xs) = x :! foo xs
```

Here the element type of `[]` is `It (List a)`, we should also normalize
it as `a`.

Test Plan: make test TEST="T14547"

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #14547

Differential Revision: https://phabricator.haskell.org/D4624

16 months agoRevert "Normalize the element type of ListPat, fix #14547"
Ben Gamari [Tue, 8 May 2018 14:07:53 +0000 (10:07 -0400)] 
Revert "Normalize the element type of ListPat, fix #14547"

This reverts commit 361d23a8ebb44f5df5167306d7b98d8bd1724e06.

16 months agousers-guide: Move discussion MAX_PATH out of release notes
Ben Gamari [Mon, 7 May 2018 18:43:45 +0000 (14:43 -0400)] 
users-guide: Move discussion MAX_PATH out of release notes

This discussion will be useful for users; move it into the users-guide proper.
Also fixes a few typos noted by @Phyx.

Test Plan: Read it

Reviewers: Phyx

Reviewed By: Phyx

Subscribers: dfeuer, Phyx, rwbarton, thomie, carter

Differential Revision: https://phabricator.haskell.org/D4420

16 months agoSimplify the kind checking for type/class decls
Simon Peyton Jones [Fri, 4 May 2018 15:31:55 +0000 (16:31 +0100)] 
Simplify the kind checking for type/class decls

This patch deletes quite a bit of code,
AND fixes Trac #15116.

16 months agoUsed named fields for DataDeclRn
Simon Peyton Jones [Fri, 4 May 2018 15:25:46 +0000 (16:25 +0100)] 
Used named fields for DataDeclRn

16 months agoSmall refactoring in Exitify
Simon Peyton Jones [Fri, 4 May 2018 15:24:26 +0000 (16:24 +0100)] 
Small refactoring in Exitify

This refactoring was provoked by our conversation on
Trac #14152.  No change in behaviour.

16 months agoprintStackChunk: recognise a few more ret frames
Ömer Sinan Ağacan [Sun, 6 May 2018 07:31:22 +0000 (10:31 +0300)] 
printStackChunk: recognise a few more ret frames

16 months agotestsuite: Bump T5631 expected allocations
Ben Gamari [Sun, 6 May 2018 01:50:37 +0000 (21:50 -0400)] 
testsuite: Bump T5631 expected allocations

This was failing on Darwin; I believe this is due to 33de71fa06d0.

16 months agobase/changelog: Note stabilization of asinh (#14927)
Ben Gamari [Sun, 6 May 2018 01:48:17 +0000 (21:48 -0400)] 
base/changelog: Note stabilization of asinh (#14927)

16 months agoStable area hyperbolic sine for `Double` and `Float`.
Justus Sagemüller [Wed, 28 Mar 2018 13:51:16 +0000 (15:51 +0200)] 
Stable area hyperbolic sine for `Double` and `Float`.

This function was unstable, in particular for negative arguments.

https://ghc.haskell.org/trac/ghc/ticket/14927

The reason is that the formula `log (x + sqrt (1 + x*x))` is dominated
by the numerical error of the `sqrt` function when x is strongly negative
(and thus the summands in the `log` mostly cancel). However, the area
hyperbolic sine is an odd function, thus the negative side can as well
be calculated by flipping over the positive side, which avoids this instability.

Furthermore, for _very_ big arguments, the `x*x` subexpression overflows. However,
long before that happens, the square root is anyways completely dominated
by that term, so we can neglect the `1 +` and get

    sqrt (1 + x*x) ≈ sqrt (x*x) = x

and therefore

    asinh x ≈ log (x + x) = log (2*x) = log 2 + log x

which does not overflow for any normal-finite positive argument, but
perfectly matches the exact formula within the floating-point accuracy.

16 months agoAdd hyperbolic functions to test of Float-inverses
Justus Sagemüller [Wed, 28 Mar 2018 12:44:51 +0000 (14:44 +0200)] 
Add hyperbolic functions to test of Float-inverses

The area hyperbolic sine is currently broken,
see https://ghc.haskell.org/trac/ghc/ticket/14927.

16 months agoAdd test for invertability of `Floating` methods.
Justus Sagemüller [Wed, 28 Mar 2018 10:52:30 +0000 (12:52 +0200)] 
Add test for invertability of `Floating` methods.

These functions have inverses only on part of the real line, but
there they should be reliably inverted – that's basically the whole
point of the functions like `asin`, `atan` etc..

16 months agoAdd 'addWordC#' PrimOp
Sebastian Graf [Sat, 5 May 2018 17:30:32 +0000 (13:30 -0400)] 
Add 'addWordC#' PrimOp

This is mostly for congruence with 'subWordC#' and '{add,sub}IntC#'.
I found 'plusWord2#' while implementing this, which both lacks
documentation and has a slightly different specification than
'addWordC#', which means the generic implementation is unnecessarily
complex.

While I was at it, I also added lacking meta-information on PrimOps
and refactored 'subWordC#'s generic implementation to be branchless.

Reviewers: bgamari, simonmar, jrtc27, dfeuer

Reviewed By: bgamari, dfeuer

Subscribers: dfeuer, thomie, carter

Differential Revision: https://phabricator.haskell.org/D4592

16 months agoUse unsafeInsertNew to create timers in TimerManager
Mitchell Rosen [Mon, 30 Apr 2018 22:05:07 +0000 (18:05 -0400)] 
Use unsafeInsertNew to create timers in TimerManager

16 months agoDo not supply `-mcpu` if `-optlc` provides `-mcpu` already.
Moritz Angermann [Fri, 4 May 2018 18:39:16 +0000 (14:39 -0400)] 
Do not supply `-mcpu` if `-optlc` provides `-mcpu` already.

Reviewers: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #14982

Differential Revision: https://phabricator.haskell.org/D4548

16 months agotestsuite: Add test for #15067
Ben Gamari [Fri, 4 May 2018 18:26:30 +0000 (14:26 -0400)] 
testsuite: Add test for #15067

Subscribers: thomie, carter, RyanGlScott

GHC Trac Issues: #15067

Differential Revision: https://phabricator.haskell.org/D4622

16 months agoNormalize the element type of ListPat, fix #14547
HE, Tao [Thu, 3 May 2018 21:16:09 +0000 (17:16 -0400)] 
Normalize the element type of ListPat, fix #14547

The element type of `List` maybe a type family instacen, rather than a
trivial type.  For example in Trac #14547,

```
{-# LANGUAGE TypeFamilies, OverloadedLists #-}

class Foo f where
        type It f
        foo :: [It f] -> f

data List a = Empty | a :! List a deriving Show

instance Foo (List a) where
        type It (List a) = a
        foo [] = Empty
        foo (x : xs) = x :! foo xs
```

Here the element type of `[]` is `It (List a)`, we should also normalize
it as `a`.

Test Plan: make test TEST="T14547"

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #14547

Differential Revision: https://phabricator.haskell.org/D4624

16 months agoSplit TrieMap into a general (TrieMap) and core specific (CoreTrieMap) module.
klebinger.andreas@gmx.at [Thu, 3 May 2018 20:20:03 +0000 (16:20 -0400)] 
Split TrieMap into a general (TrieMap) and core specific (CoreTrieMap) module.

Splitting TrieMap into a general and core specific part allows us to
define instances for TrieMap without creating a transitive dependency on
CoreSyn.

Test Plan: ci

Reviewers: goldfire, bgamari, simonmar, simonpj

Reviewed By: bgamari, simonpj

Subscribers: simonpj, nomeata, thomie, carter

GHC Trac Issues: #15082

Differential Revision: https://phabricator.haskell.org/D4618

16 months agorel-notes: Note that -hT is now allowed
Ben Gamari [Thu, 3 May 2018 20:19:22 +0000 (16:19 -0400)] 
rel-notes: Note that -hT is now allowed

See #15086.

[skip-ci]

16 months agoFix typo in user guide about promoted list
Masahiro Sakai [Thu, 26 Apr 2018 14:42:43 +0000 (23:42 +0900)] 
Fix typo in user guide about promoted list

`:'` in explanation text should be `':` to match code example.

16 months agoUpdate docker images to use GHC 8.4.2 and cabal-install-2.2
mrkkrp [Thu, 26 Apr 2018 08:12:15 +0000 (15:12 +0700)] 
Update docker images to use GHC 8.4.2 and cabal-install-2.2

The ‘haskell’ images are not being updated and there is no image with GHC
8.4.2, so we probably should not use them anymore. I adapted Dockerfiles
used by those images so the end result is almost the same except we get
newer GHC and cabal-install.

16 months agotestsuite: Bump T9630 allocations as a result of 33de71fa06d0
Ben Gamari [Sat, 5 May 2018 17:08:04 +0000 (13:08 -0400)] 
testsuite: Bump T9630 allocations as a result of 33de71fa06d0

This patch made the simplifier inline nested function bindings less aggressively
and, while it didn't seem to affect nofib, appears to have regressed T9630
rather considerably.

16 months agoSimplify callSiteInline a little
Simon Peyton Jones [Fri, 4 May 2018 14:47:31 +0000 (15:47 +0100)] 
Simplify callSiteInline a little

This patch has virtually no effect on anything (according to a
nofib run).  But it simplifies the definition of interesting_call
by being a bit less gung-ho about inlining nested function
bindings.  See Note [Nested functions]

-----------------------------------------------------------------------
        Program           Size    Allocs   Runtime   Elapsed  TotalMem
-----------------------------------------------------------------------
           anna          +0.2%     -0.0%     0.163     0.163      0.0%
   binary-trees          +0.1%     +0.0%     -4.5%     -4.5%      0.0%
      cacheprof          -0.1%     +0.1%     -4.7%     -4.8%     +2.7%
          fasta          +0.2%      0.0%     +2.6%     +3.0%      0.0%
          fluid          -0.0%     -0.6%     0.011     0.011      0.0%
         gamteb          -0.1%     -0.0%     0.069     0.070      0.0%
            hpg          +0.1%     +0.0%     +0.7%     +0.7%      0.0%
          infer          +0.3%     +0.2%     0.097     0.098      0.0%
         lambda          -0.1%     -0.0%     +2.0%     +2.0%      0.0%
         n-body          +0.1%     -0.1%     -0.1%     -0.1%      0.0%
         simple          -0.2%     -0.2%     +0.6%     +0.6%      0.0%
  spectral-norm          +0.1%     -0.0%     -0.1%     -0.1%      0.0%
            tak          -0.0%     -0.1%     0.024     0.024      0.0%
--------------------------------------------------------------------------------
            Min          -0.4%     -0.6%     -5.3%     -5.3%      0.0%
            Max          +0.3%     +0.2%     +3.3%     +3.3%    +15.0%
 Geometric Mean          -0.0%     -0.0%     -0.3%     -0.3%     +0.2%

16 months agoNormalize T14999 test output some more
Bartosz Nitka [Fri, 4 May 2018 09:44:46 +0000 (02:44 -0700)] 
Normalize T14999 test output some more

@osa1 reported that the output on his machine has extra newlines:
https://phabricator.haskell.org/D4606#129092. This collapses consecutive
newlines.

16 months agoEnable warning flags to safe-guard against regressions in `base`
Herbert Valerio Riedel [Thu, 3 May 2018 16:50:25 +0000 (12:50 -0400)] 
Enable warning flags to safe-guard against regressions in `base`

Test Plan: via CI

Reviewers: bgamari

Subscribers: dfeuer, thomie, carter

Differential Revision: https://phabricator.haskell.org/D4640

16 months agorts: Throw better error if --numa is used without libnuma support
Ben Gamari [Thu, 3 May 2018 16:42:24 +0000 (12:42 -0400)] 
rts: Throw better error if --numa is used without libnuma support

Test Plan: Validate, run program with `+RTS --numa` without libnuma
support compiled in

Reviewers: erikd, simonmar

Subscribers: thomie, carter

GHC Trac Issues: #14956

Differential Revision: https://phabricator.haskell.org/D4556

16 months agoGHCi: Improve the error message for hidden packages
Chaitanya Koparkar [Thu, 3 May 2018 16:39:45 +0000 (12:39 -0400)] 
GHCi: Improve the error message for hidden packages

Test Plan: make test TEST=T15055

Reviewers: bgamari, RyanGlScott, osa1, Iceland_jack

Reviewed By: osa1

Subscribers: ulysses4ever, thomie, carter

GHC Trac Issues: #15055

Differential Revision: https://phabricator.haskell.org/D4621

16 months agoMove the ResponseFile module from haddock into base
Chaitanya Koparkar [Thu, 3 May 2018 16:38:36 +0000 (12:38 -0400)] 
Move the ResponseFile module from haddock into base

GHC and the build tools use "response files" to work around the limit
on the length of command line arguments on Windows. Haddock's
implementation of parsing response files (i.e escaping/unescaping the
appropriate characters) seems complete, is well tested, and also
closely matches the GCC version. This patch moves the relevant bits
into `base` so that it's easier for other libraries to reuse it.

Test Plan: make test TEST=T13896

Reviewers: bgamari, RyanGlScott, 23Skidoo, hvr

Reviewed By: RyanGlScott

Subscribers: thomie, carter

GHC Trac Issues: #13896

Differential Revision: https://phabricator.haskell.org/D4612

16 months agoCorrectly add unwinding info in manifestSp and makeFixupBlocks
Bartosz Nitka [Thu, 3 May 2018 16:37:00 +0000 (12:37 -0400)] 
Correctly add unwinding info in manifestSp and makeFixupBlocks

In `manifestSp` the unwind info was before the relevant instruction, not
after.  I added some notes to establish semantics.  Also removes
redundant annotation in stg_catch_frame.

For `makeFixupBlocks` it looks like we were off by `wORD_SIZE dflags`.
I'm not sure why, but it lines up with `manifestSp`.  In fact it lines
up so well so that I can consolidate the Sp unwind logic in
`maybeAddUnwind`.  I detected the problems with `makeFixupBlocks` by
running T14779b after patching D4559.

Test Plan: added a new test

Reviewers: bgamari, scpmw, simonmar, erikd

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #14999

Differential Revision: https://phabricator.haskell.org/D4606

16 months agoFix NUMA support on Windows (#15049)
David Kraeutmann [Thu, 3 May 2018 16:36:34 +0000 (12:36 -0400)] 
Fix NUMA support on Windows (#15049)

* osNumaNodes now returns the right number of nodes
* thread affinity is now correctly set

TODO: no noticeable performance improvement.
does windows already distribute threads in a NUMA-aware fashion?

Test Plan:
* validate
* local tests on a NUMA machine

Reviewers: bgamari, erikd, simonmar

Reviewed By: bgamari, simonmar

Subscribers: thomie, carter

Differential Revision: https://phabricator.haskell.org/D4607

16 months agoCircleCI: Save test results as JUnit XML
Matthew Pickering [Thu, 3 May 2018 16:35:22 +0000 (12:35 -0400)] 
CircleCI: Save test results as JUnit XML

Reviewers: mrkkrp, bgamari

Reviewed By: mrkkrp, bgamari

Subscribers: thomie, carter

GHC Trac Issues: #15093

Differential Revision: https://phabricator.haskell.org/D4646

16 months agoDon't shadow "result" in JUnit driver
Matthew Pickering [Thu, 3 May 2018 16:35:07 +0000 (12:35 -0400)] 
Don't shadow "result" in JUnit driver

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #15093

Differential Revision: https://phabricator.haskell.org/D4645

16 months agominor improvement to wording of warning against First. Add warning against Last
Andrew Martin [Thu, 26 Apr 2018 01:01:25 +0000 (21:01 -0400)] 
minor improvement to wording of warning against First. Add warning against Last

16 months agodocument the plan for removing Data.Semigroup.Option
Andrew Martin [Wed, 25 Apr 2018 23:44:29 +0000 (19:44 -0400)] 
document the plan for removing Data.Semigroup.Option

16 months agoWarn against using Data.Monoid.First
Andrew Martin [Wed, 25 Apr 2018 23:35:36 +0000 (19:35 -0400)] 
Warn against using Data.Monoid.First

Noting that it will be removed in the future.

16 months agoCompute DW_FORM_block length correctly; also fixes #15068
Bertram Felgenhauer [Thu, 3 May 2018 15:03:53 +0000 (18:03 +0300)] 
Compute DW_FORM_block length correctly; also fixes #15068

Before this patch, the pprUnwindwExpr function computed the length of
by the following assembly fragment:

.uleb128 1f-.-1
<expression data>
1:

That is, to compute the length, it takes the difference of the label 1
and the address of the .uleb128 directive, and subtracts 1.

In #15068 it was reported that `as` from binutils 4.30 has trouble with
evaluating the `.` part of the expression. However, there is actually a
problem with the expression, if the length of the data ever becomes
larger than 128: In that case, the .uleb128 directive will emit more
than 1 byte, and the computed length will be wrong.

The present patch changes the assembly fragment to use two labels,
which fixes both these problems.

.uleb128 2f-1f
1:
<expression data>
2:

Test Plan: validate

Reviewers: bgamari, osa1

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #15068

Differential Revision: https://phabricator.haskell.org/D4654

16 months agoAdd regression tests for #14904
Ryan Scott [Thu, 3 May 2018 14:15:45 +0000 (10:15 -0400)] 
Add regression tests for #14904

Trac #14904 was fixed in commit
faec8d358985e5d0bf363bd96f23fe76c9e281f7. Let's add some tests to
ensure that it stays fixed.

16 months agoTest Trac #15114
Simon Peyton Jones [Thu, 3 May 2018 07:51:29 +0000 (08:51 +0100)] 
Test Trac #15114

16 months agoSet arity for absentError
David Feuer [Thu, 3 May 2018 03:43:13 +0000 (23:43 -0400)] 
Set arity for absentError

* The note on how to prevent stable unfoldings from leading to
  `case` on `absentError` was wrong. Make it reflect reality.

* Reviewing the above change, Simon noticed that we didn't
  set an arity for `absentError`, which definitely has arity 1.
  It may not matter much, since `absentError` usually vanishes
  quickly, but we might as well set it properly, so now we do.

Reviewers: simonpj, bgamari

Reviewed By: simonpj

Subscribers: thomie, carter

Differential Revision: https://phabricator.haskell.org/D4655

16 months agostorageAddCapabilities: fix bug in updating nursery pointers
Simon Marlow [Fri, 27 Apr 2018 18:31:19 +0000 (11:31 -0700)] 
storageAddCapabilities: fix bug in updating nursery pointers

Summary:
We were unconditionally updating the nursery pointers to be
`nurseries[cap->no]`, but when using nursery chunks this might be
wrong. This manifested as a later assertion failure in allocate().

Test Plan: new test case

Reviewers: bgamari, niteria, erikd

Subscribers: thomie, carter

Differential Revision: https://phabricator.haskell.org/D4649

16 months agoerrorWithoutStackTrace: omit profiling stack trace (#14970)
Simon Marlow [Sat, 21 Apr 2018 11:22:18 +0000 (12:22 +0100)] 
errorWithoutStackTrace: omit profiling stack trace (#14970)

Test Plan: validate

Reviewers: hvr, bgamari, erikd

Subscribers: thomie, carter

Differential Revision: https://phabricator.haskell.org/D4648

16 months agoExitify: Do not trip over shadowing (fixes #15110)
Joachim Breitner [Wed, 2 May 2018 02:33:01 +0000 (22:33 -0400)] 
Exitify: Do not trip over shadowing (fixes #15110)

16 months agorts: Allow profiling by closure type in prof way
Ben Gamari [Tue, 1 May 2018 17:10:13 +0000 (13:10 -0400)] 
rts: Allow profiling by closure type in prof way

Previously we inexplicably disabled support for `-hT` profiling in the profiled
way. Admittedly, there are relatively few cases where one would prefer -hT to
`-hd`, but the option should nevertheless be available for the sake of
consistency.

Note that this does mean that there is a bit of an inconsistency in the behavior
of `-h`: in the profiled way `-h` behaves like `-hc` whereas in the non-profiled
way it defaults to `-hT`.

16 months agorts: Add -hT to the rts usage message
Ben Gamari [Tue, 1 May 2018 18:57:31 +0000 (14:57 -0400)] 
rts: Add -hT to the rts usage message

Reviewers: erikd, simonmar

Subscribers: thomie, carter

GHC Trac Issues: #15086

Differential Revision: https://phabricator.haskell.org/D4643

16 months agotestsuite: Bump performance meterics due to 3d38e8284b73
Ben Gamari [Mon, 30 Apr 2018 22:01:12 +0000 (18:01 -0400)] 
testsuite: Bump performance meterics due to 3d38e8284b73

This commit bumped T12425, T12234 and T12150 over their expected metrics on OS
X.

16 months agorts: Don't disable formatting warning in RetainerSet.c
Ben Gamari [Wed, 25 Apr 2018 14:46:48 +0000 (10:46 -0400)] 
rts: Don't disable formatting warning in RetainerSet.c

This really shouldn't be necessary.

16 months agoPreserve join-point arity in CoreOpt
Simon Peyton Jones [Tue, 1 May 2018 11:16:28 +0000 (12:16 +0100)] 
Preserve join-point arity in CoreOpt

Trac #15108 showed that the simple optimiser in CoreOpt
was accidentally eta-reducing a join point, so it didn't meet
its arity invariant.

This patch fixes it.  See Note [Preserve join-binding arity].

16 months agoDon't crash when pretty-printing bad joins
Simon Peyton Jones [Tue, 1 May 2018 10:11:46 +0000 (11:11 +0100)] 
Don't crash when pretty-printing bad joins

Trac #15108 showed that the Core pretty-printer would
crash if it found a join-point binding with too few lambda
on the RHS.  That is super-unhelpful!  Lint will find it,
but pretty-printing should not crash.

This patch just makes the pretty printer behave more robustly;
it leaves the job of error reporting to Lint.

16 months agoAdd test case for #15108
Joachim Breitner [Tue, 1 May 2018 02:13:38 +0000 (22:13 -0400)] 
Add test case for #15108

thanks to cdisselkoen for the nicely minimized test case.

16 months agoBetter linting for types
Simon Peyton Jones [Fri, 27 Apr 2018 15:32:02 +0000 (16:32 +0100)] 
Better linting for types

Trac #15057 described deficiencies in the linting for types
involving type synonyms.  This patch fixes an earlier attempt.

The moving parts are desrcribed in
  Note [Linting type synonym applications]

Not a big deal.

16 months agoMake out-of-scope errors more prominent
Simon Peyton Jones [Fri, 27 Apr 2018 15:15:25 +0000 (16:15 +0100)] 
Make out-of-scope errors more prominent

Generally, when the type checker reports an error, more serious
ones suppress less serious ones.

A "variable out of scope" error is arguably the most serious of all,
so this patch moves it to the front of the list instead of the end.

This patch also fixes Trac #14149, which had
-fdefer-out-of-scope-variables, but also had a solid type error.
As things stood, the type error was not reported at all, and
compilation "succeeded" with error code 0.  Yikes.

Note that

- "Hole errors" (including out of scope) are never suppressed.
  (maybeReportHoleError vs maybeReportError in TcErorrs)
  They can just get drowned by the noise.

- But with the new orientation, out of scope errors will suppress
  type errors.  That would be easy to change.

16 months agoRefactor tcExtendLocalFamInst a bit
Simon Peyton Jones [Thu, 26 Apr 2018 13:04:29 +0000 (14:04 +0100)] 
Refactor tcExtendLocalFamInst a bit

This patch just pulls out FamInst.loadDependentFamInstModules
as a separate function, and adds better comments.

Provoked by Trac #14759, comment:10.

16 months agoComments only: the FVAnn invariant
Simon Peyton Jones [Fri, 20 Apr 2018 16:51:58 +0000 (17:51 +0100)] 
Comments only: the FVAnn invariant

16 months agoMinor refactoring in Exitify
Simon Peyton Jones [Fri, 20 Apr 2018 16:50:56 +0000 (17:50 +0100)] 
Minor refactoring in Exitify

No change in behaviour here, just some modest
refactoring as I tried to understand the code
better.

16 months agoAdd missing stdout file for T14955
Simon Peyton Jones [Fri, 27 Apr 2018 15:54:22 +0000 (16:54 +0100)] 
Add missing stdout file for T14955

Accidentally omitted from Trac #14955 commit.

16 months agoTTG : complete for balance of hsSyn AST
Alan Zimmerman [Wed, 18 Apr 2018 21:55:14 +0000 (23:55 +0200)] 
TTG : complete for balance of hsSyn AST

Summary:
- remove PostRn/PostTc fields
- remove the HsVect In/Out distinction for Type, Class and Instance
- remove PlaceHolder in favour of NoExt
- Simplify OutputableX constraint

Updates haddock submodule

Test Plan: ./validate

Reviewers: goldfire, bgamari

Subscribers: goldfire, thomie, mpickering, carter

Differential Revision: https://phabricator.haskell.org/D4625

16 months agoRename a local variable
Simon Peyton Jones [Fri, 20 Apr 2018 16:13:31 +0000 (17:13 +0100)] 
Rename a local variable

16 months agoRefactor in OccurAnal
Simon Peyton Jones [Fri, 12 Jan 2018 17:34:49 +0000 (17:34 +0000)] 
Refactor in OccurAnal

* (+++)                    -->  andUDs
* combineAltsUsageDetails  -->  orUDs
* combineUsageDetailsList  -->  andUDsList
* Change some andUDsList to a fold for efficiency

No change in behaviour

16 months agoComments only
Simon Peyton Jones [Fri, 12 Jan 2018 17:31:06 +0000 (17:31 +0000)] 
Comments only

16 months agoDo not unpack class dictionaries with INLINABLE
Simon Peyton Jones [Thu, 26 Apr 2018 14:59:13 +0000 (15:59 +0100)] 
Do not unpack class dictionaries with INLINABLE

Matthew Pickering uncovered a bad performance hole in the way
that single-method dictionaries work, described in Trac #14955.

See Note [Do not unpack class dictionaries] in WwLib.

I tried to fix this 6 years ago, but got it slightly wrong.  This patch
fixes it, which makes a dramatic improvement in the test case.

Nofib highlights: not much happening:

  Program           Size    Allocs   Runtime   Elapsed  TotalMem
-----------------------------------------------------------------
      VSM          -0.3%     +2.7%     -7.4%     -7.4%      0.0%
cacheprof          -0.0%     +0.1%     +0.3%     +0.7%      0.0%
  integer          -0.0%     +1.1%     +7.5%     +7.5%      0.0%
      tak          -0.1%     -0.2%     0.024     0.024      0.0%
-----------------------------------------------------------------
      Min          -4.4%     -0.2%     -7.4%     -7.4%     -8.0%
      Max          +0.6%     +2.7%     +7.5%     +7.5%      0.0%
Geom Mean          -0.1%     +0.0%     +0.1%     +0.1%     -0.2%

I investigated VSM.  The patch unpacks class dictionaries a bit more
than before (i.e. does so if there is no INLINABLE pragma). And that
gives better code in VSM (less dictionary selection etc), but one closure
gets one word bigger.

I'll accept these changes in exchange for more robust performance.

Some ghci.debugger output wobbled around (order of bindings
being displayed). I have no idea why; but I accepted the changes.

16 months agoUpdate Hadrian submodule
Andrey Mokhov [Wed, 25 Apr 2018 22:57:28 +0000 (23:57 +0100)] 
Update Hadrian submodule

  * Link to Quick Start guide
  * Update README.md (hadrian/578)
  * Fix AppVeyor (hadrian/577)
  * Fix CircleCI
  * Generic library rules (hadrian/571)
  * Fix lint error (hadrian/575)
  * Fix missing libHSghc-8.5-0.a (hadrian/574)
  * Fix the path to touchy (hadrian/572)
  * Fix integer-gmp build (hadrian/568)
  * Undo fs*.h workaround
  * Fix copying of fs*.h files during RTS registration (hadrian/566)
  * Fix Windows build, improve error reporting (hadrian/565)
  * Fix Windows build (hadrian/563)
  * Fix boot and configure on AppVeyor (hadrian/561)
  * Preliminary bindist (hadrian/558, hadrian/555)
  * Unregister stage0 package first if it needs to be
    cloned (hadrian/552)
  * Fix Circle CI (hadrian/553)
  * Fix warnings (hadrian/547)
  * Merge pull request hadrian/542 from Mistuke/fix-specific-file
  * Use Cabal directly in place of ghc-cabal + make build root
    configurable (hadrian/531)
  * Add user-defined flavour example for turning off dynamic
    linking (hadrian/535)
  * Add clean routines for fs (hadrian/533)
  * Add 'git' to nativeBuildInputs in shell.nix (hadrian/530)
  * Add extra include paths when invoking ghc-cabal (hadrian/526)
  * Merge pull request hadrian/528 from snowleopard/bump-cabal
  * Merge pull request hadrian/521 from snowleopard/drop-chmod
  * Change permission bits for build.cabal.sh,
    fixes hadrian/517 (hadrian/520)
  * Pin nixpkgs and all-cabal-hashes in shell.nix (hadrian/511)
  * Add troubleshooting section

16 months agoStable.c: minor refactoring, add/update some comments
Ömer Sinan Ağacan [Wed, 25 Apr 2018 17:42:26 +0000 (20:42 +0300)] 
Stable.c: minor refactoring, add/update some comments

Test Plan: Passes validate

Reviewers: simonmar, bgamari, erikd

Subscribers: thomie, carter

GHC Trac Issues: #10296

Differential Revision: https://phabricator.haskell.org/D4627

16 months agotestsuite: Fix T4442 on 32-bit architectures
Ben Gamari [Mon, 23 Apr 2018 14:42:17 +0000 (10:42 -0400)] 
testsuite: Fix T4442 on 32-bit architectures

This relied on Int# being 64-bits. This is nothing a bit of CPP can't
fix, but I think the right solution would be to make out treatment of
word-size dependent types more consistent, as suggested by #11953.

Test Plan: Validate on i386

Subscribers: thomie, carter

Differential Revision: https://phabricator.haskell.org/D4614

16 months agotestsuite: Fix overflow in T13623 on 32-bit machines
Ben Gamari [Mon, 23 Apr 2018 14:41:38 +0000 (10:41 -0400)] 
testsuite: Fix overflow in T13623 on 32-bit machines

We simply truncate the result to 32-bits to ensure that the test passed
under both environments.

Test Plan: Validate on 32-bit

Subscribers: thomie, carter

GHC Trac Issues: #13623

Differential Revision: https://phabricator.haskell.org/D4615

16 months agoghc-prim: Refactor and document __sync_fetch_and_nand workaround
Ben Gamari [Mon, 23 Apr 2018 14:40:34 +0000 (10:40 -0400)] 
ghc-prim: Refactor and document __sync_fetch_and_nand workaround

ed6f9fb9d5a684d2159c29633159c3254cf04deb reduced the scope of this hack
to only include Clangs which actually lack __sync_fetch_and_nand.
However, this causes GHC to fail to build with -Werror on Clang due to
the lack of the -Wsync-nand warning flag. As it turns out a flag
controlling the warning is available under a different name, however.

Test Plan: Validate with Clang, GCC

Subscribers: thomie, carter

GHC Trac Issues: #9678

Differential Revision: https://phabricator.haskell.org/D4613

16 months agoAdd testcase for #15050
Joachim Breitner [Mon, 23 Apr 2018 17:02:50 +0000 (13:02 -0400)] 
Add testcase for #15050

so that we notice if someone accidentially implements this...

16 months agocoercion: Improve debugging output
Simon Peyton Jones [Mon, 23 Apr 2018 13:38:35 +0000 (09:38 -0400)] 
coercion: Improve debugging output

* Improve assertion-failure message
* Add HasDebugCallStack to decomposeFunCo

Reviewers: goldfire, bgamari

Subscribers: thomie, carter

Differential Revision: https://phabricator.haskell.org/D4570

16 months agousers-guide: Fix up formatting in 8.6 release notes
Ben Gamari [Sun, 22 Apr 2018 22:32:53 +0000 (18:32 -0400)] 
users-guide: Fix up formatting in 8.6 release notes

16 months agoTypo fix in scavenge_one comment [skip ci]
Ömer Sinan Ağacan [Sun, 22 Apr 2018 07:27:17 +0000 (10:27 +0300)] 
Typo fix in scavenge_one comment [skip ci]

16 months agoRemove a outdated comment [skip ci]
Ömer Sinan Ağacan [Sat, 21 Apr 2018 19:21:29 +0000 (22:21 +0300)] 
Remove a outdated comment [skip ci]

16 months agorts: Use g0 for &generations[0]
Ömer Sinan Ağacan [Sat, 21 Apr 2018 16:09:15 +0000 (19:09 +0300)] 
rts: Use g0 for &generations[0]

[skip ci]

16 months agos/traverse_weak_ptr_list/traverseWeakPtrList in comments [skip ci]
Ömer Sinan Ağacan [Sat, 21 Apr 2018 11:26:34 +0000 (14:26 +0300)] 
s/traverse_weak_ptr_list/traverseWeakPtrList in comments [skip ci]

16 months agoRemove unnecessary check in simplCast
Tobias Dammers [Fri, 20 Apr 2018 20:38:34 +0000 (16:38 -0400)] 
Remove unnecessary check in simplCast

The coercion optimizer will take care of it anyway, and the check is
prohibitively expensive.

See Trac #14737.

Reviewers: bgamari

Subscribers: simonpj, thomie, carter

Differential Revision: https://phabricator.haskell.org/D4568

16 months agobase: Add a test for T10412
Ben Gamari [Fri, 20 Apr 2018 17:54:04 +0000 (13:54 -0400)] 
base: Add a test for T10412

Expects the current behavior, will be updated by D4593 to reflect
desired behavior.

Reviewers: hvr

Subscribers: thomie, carter

GHC Trac Issues: #10412

Differential Revision: https://phabricator.haskell.org/D4610

16 months agoFix implementation of rnIfaceBndr
Matthew Pickering [Fri, 20 Apr 2018 17:32:30 +0000 (13:32 -0400)] 
Fix implementation of rnIfaceBndr

Reviewers: ezyang, bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #15041

Differential Revision: https://phabricator.haskell.org/D4600

16 months agoRemove broken top-level shell.nix
Matthew Pickering [Fri, 20 Apr 2018 17:31:49 +0000 (13:31 -0400)] 
Remove broken top-level shell.nix

There is a maintained shell.nix file in the hadrian submodule. This
has long since been broken anyway.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #15045

Differential Revision: https://phabricator.haskell.org/D4599

16 months agocomments only
Simon Peyton Jones [Fri, 20 Apr 2018 12:58:38 +0000 (13:58 +0100)] 
comments only

16 months agoInline wrappers earlier
Simon Peyton Jones [Fri, 20 Apr 2018 12:57:16 +0000 (13:57 +0100)] 
Inline wrappers earlier

This patch has a single significant change:

  strictness wrapper functions are inlined earlier,
  in phase 2 rather than phase 0.

As shown by Trac #15056, this gives a better chance for RULEs to fire.
Before this change, a function that would have inlined early without
strictness analyss was instead inlining late. Result: applying
"optimisation" made the program worse.

This does not make too much difference in nofib, but I've stumbled
over the problem more than once, so even a "no-change" result would be
quite acceptable.  Here are the headlines:

--------------------------------------------------------------------------------
        Program           Size    Allocs   Runtime   Elapsed  TotalMem
--------------------------------------------------------------------------------
      cacheprof          -0.5%     -0.5%     +2.5%     +2.5%      0.0%
         fulsom          -1.0%     +2.6%     -0.1%     -0.1%      0.0%
           mate          -0.6%     +2.4%     -0.9%     -0.9%      0.0%
        veritas          -0.7%    -23.2%     0.002     0.002      0.0%
--------------------------------------------------------------------------------
            Min          -1.4%    -23.2%    -12.5%    -15.3%      0.0%
            Max          +0.6%     +2.6%     +4.4%     +4.3%    +19.0%
 Geometric Mean          -0.7%     -0.2%     -1.4%     -1.7%     +0.2%

* A worthwhile reduction in binary size.

* Runtimes are not to be trusted much but look as if they
  are moving the right way.

* A really big win in veritas, described in comment:1 of
  Trac #15056; more fusion rules fired.

* I investigated the losses in 'mate' and 'fulsom'; see #15056.

16 months agoCaching coercion roles in NthCo and coercionKindsRole refactoring
Tobias Dammers [Fri, 20 Apr 2018 13:11:14 +0000 (09:11 -0400)] 
Caching coercion roles in NthCo and coercionKindsRole refactoring

While addressing nonlinear behavior related to coercion roles,
particularly `NthCo`, we noticed that coercion roles are recalculated
often even though they should be readily at hand already in most cases.
This patch adds a `Role` to the `NthCo` constructor so that we can cache
them rather than having to recalculate them on the fly.
https://ghc.haskell.org/trac/ghc/ticket/11735#comment:23 explains the
approach.

Performance improvement over GHC HEAD, when compiling Grammar.hs (see below):

GHC 8.2.1:
```
ghc Grammar.hs  176.27s user 0.23s system 99% cpu 2:56.81 total
```

before patch (but with other optimizations applied):
```
ghc Grammar.hs -fforce-recomp  175.77s user 0.19s system 100% cpu 2:55.78 total
```

after:
```
../../ghc/inplace/bin/ghc-stage2 Grammar.hs  10.32s user 0.17s system 98% cpu 10.678 total
```

Introduces the following regressions:

- perf/compiler/parsing001 (possibly false positive)
- perf/compiler/T9872
- perf/compiler/haddock.base

Reviewers: goldfire, bgamari, simonpj

Reviewed By: simonpj

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #11735

Differential Revision: https://phabricator.haskell.org/D4394

16 months agoBump transformers submodule
Ryan Scott [Fri, 20 Apr 2018 14:14:31 +0000 (10:14 -0400)] 
Bump transformers submodule

This brings in a commit which migrates Contravariant instances from
base to transformers.

16 months agoFixes isAlphaNum re. isAlpha/isNumber and doc fix (trac issue #10412)
ARJANEN Loïc Jean David [Fri, 20 Apr 2018 00:48:28 +0000 (20:48 -0400)] 
Fixes isAlphaNum re. isAlpha/isNumber and doc fix (trac issue #10412)

Corrects the inconsistency between Data.Char.isAlphaNum,
Data.Char.isAlpha and Data.Char.isNumber. Indeed, isAlphaNum was
returning True not only when isAlpha or isNumber returned True but
also when isMark did. The selectors for the Mn, Mc and Me general
categories where removed from the macro generating u_iswalnum in
ubconfc.

Also, Data.Char.isAlphaNum's documentation was changed to state that
isAlphaNum returns true not only for Unicode number digits but for
Unicode numbers in general in Unicode.hs.

Signed-off-by: ARJANEN Loïc Jean David <arjanen.loic@gmail.com>
Reviewers: hvr, ekmett, lelf, bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #10412

Differential Revision: https://phabricator.haskell.org/D4593

16 months agoLint types in newFamInst
Ryan Scott [Fri, 20 Apr 2018 00:47:48 +0000 (20:47 -0400)] 
Lint types in newFamInst

We weren't linting the types used in `newFamInst`, which
might have been why #15012 went undiscovered for so long. Let's fix
that.

One has to be surprisingly careful with expanding type synonyms in
`lintType`, since in the offending program (simplified):

```lang=haskell
type FakeOut a = Int

type family TF a
type instance TF Int = FakeOut a
```

If one expands type synonyms, then `FakeOut a` will expand to
`Int`, which masks the issue (that `a` is unbound). I added an
extra Lint flag to configure whether type synonyms should be
expanded or not in Lint, and disabled this when calling `lintTypes`
from `newFamInst`.

As evidence that this works, I ran it on the offending program
from #15012, and voilà:

```
$ ghc3/inplace/bin/ghc-stage2 Bug.hs -dcore-lint
[1 of 1] Compiling Foo              ( Bug.hs, Bug.o )
ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 8.5.20180417 for x86_64-unknown-linux):
        Core Lint error
  <no location info>: warning:
      In the type ‘... (Rec0 (FakeOut b_a1Qt))))’
      @ b_a1Qt is out of scope
```

Test Plan: make test TEST=T15057

Reviewers: simonpj, goldfire, bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #15057

Differential Revision: https://phabricator.haskell.org/D4611

16 months agoboot: Fix computation of TOP
Ben Gamari [Thu, 19 Apr 2018 19:07:57 +0000 (15:07 -0400)] 
boot: Fix computation of TOP

Test Plan: Run `./boot`, check to make sure that
`libraries/ghc-prim/GNUmakefile` is sane

Subscribers: thomie, carter, sjakobi

Differential Revision: https://phabricator.haskell.org/D4580

16 months agoconfigure: Use -Werror to check for existence of -no-pie
Ben Gamari [Thu, 19 Apr 2018 19:05:50 +0000 (15:05 -0400)] 
configure: Use -Werror to check for existence of -no-pie

Clang throws a warning instead of an error when it is passed -no-pie,

    clang: warning: argument unused during compilation: '-nopie'
    [-Wunused-command-line-argument]

Consequently configure concludes that it supports -no-pie. However, this
will fail when used with -Werror. The solution is to simply use -Werror
in the configure check.

Thanks to @goldfire for reporting this.

Reviewers: hvr

Subscribers: thomie, carter, goldfire

Differential Revision: https://phabricator.haskell.org/D4557

17 months agoparsec: Make version hack compatible with Windows
Ben Gamari [Thu, 19 Apr 2018 19:42:26 +0000 (15:42 -0400)] 
parsec: Make version hack compatible with Windows

Fixes D4609 on Windows by bumping parsec submodule.

17 months agotestsuite: Fix `./validate --slow`
Alp Mestanogullari [Thu, 19 Apr 2018 16:40:21 +0000 (12:40 -0400)] 
testsuite: Fix `./validate --slow`

This fixes all unexpected passes and unexpected failures from a
`./validate --slow` run I did last week. I commented on many
tickets and created a few more as I was going through the failing
tests. A summary of the entire process is available at:

  https://gist.github.com/alpmestan/c371840968f086c8dc5b56af8325f0a9

This is part of an attempt to have `./validate --slow` pass,
tracked in #14890. Another patch will be necessary for the unexpected
stats failures.

Test Plan: ./validate --slow (not green yet)

Reviewers: bgamari, simonmar

Subscribers: thomie, carter

Differential Revision: https://phabricator.haskell.org/D4546

17 months agoBump base to version 4.12.0.0
Ryan Scott [Thu, 19 Apr 2018 16:38:17 +0000 (12:38 -0400)] 
Bump base to version 4.12.0.0

Summary: Bumps several submodules.

Test Plan: ./validate

Reviewers: hvr, bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #15018

Differential Revision: https://phabricator.haskell.org/D4609

17 months agoFix #15012 with a well-placed use of Any
Ryan Scott [Thu, 19 Apr 2018 16:36:42 +0000 (12:36 -0400)] 
Fix #15012 with a well-placed use of Any

Previously, derived `Generic1` instances could have associated `Rep1`
type family instances with unbound variables, such as in the following
example:

```lang=haskell
data T a = MkT (FakeOut a) deriving Generic1
type FakeOut a = Int

==>

instance Generic1 T where
  type Rep1 T = ... (Rec0 (FakeOut a))
```

Yikes! To avoid this, we simply map the last type variable in a
derived `Generic1` instance to `Any`.

Test Plan: make test TEST=T15012

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: simonpj, thomie, carter

GHC Trac Issues: #15012

Differential Revision: https://phabricator.haskell.org/D4602

17 months agoBetter error message for empty character literal, for Trac #13450.
HE, Tao [Thu, 19 Apr 2018 16:31:09 +0000 (12:31 -0400)] 
Better error message for empty character literal, for Trac #13450.

For empty character literal, the `''`, report error message properly
rather than just throw a "parser error" with wrong error location.

Test Plan: make test TEST="T13450 T13450TH"

Reviewers: goldfire, bgamari

Reviewed By: bgamari

Subscribers: thomie, mpickering, carter

GHC Trac Issues: #13450

Differential Revision: https://phabricator.haskell.org/D4594

17 months agoAdd a test for #14815:
Ömer Sinan Ağacan [Thu, 19 Apr 2018 15:32:26 +0000 (11:32 -0400)] 
Add a test for #14815:

Because the program doesn't have any binders that -XStrict can make
strict, the desugarer output should be identical when it's compiled with
and without -XStrict. This wasn't the case with GHC 8.2.2, but
apparently it was fixed some time between 8.2.2 and 8.4.1. We now add a
test case to make sure it stays fixed.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #14815

Differential Revision: https://phabricator.haskell.org/D4531

17 months agorts: fix format arguments for debugBelch calls on 32-bit systems
Sergei Trofimovich [Thu, 19 Apr 2018 15:28:46 +0000 (11:28 -0400)] 
rts: fix format arguments for debugBelch calls on 32-bit systems

This change fixes build failure like this:
```
  rts/Stats.c:1467:14: error:
     error: format '%u' expects argument of type 'unsigned int',
         but argument 4 has type 'long unsigned int' [-Werror=format=]
       debugBelch("%51s%9" FMT_Word " %9" FMT_Word "\n",
                  ^~~~~~~~
                  "",tot_live*sizeof(W_),tot_slop*sizeof(W_));
                                         ~~~~~~~~~~~~~~~~~~~
```

The fix is to cast sizeof() result to Word (W_).

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Test Plan: build for 32-bit target

Reviewers: bgamari, erikd, simonmar

Reviewed By: simonmar

Subscribers: thomie, carter

Differential Revision: https://phabricator.haskell.org/D4608