ghc.git
15 months agoAdd testcase for #14951 wip/T14951
Joachim Breitner [Thu, 22 Mar 2018 14:17:27 +0000 (10:17 -0400)] 
Add testcase for #14951

16 months agoDo cascading SpecConstr also for non-recursive bindings
Joachim Breitner [Wed, 21 Mar 2018 19:29:15 +0000 (15:29 -0400)] 
Do cascading SpecConstr also for non-recursive bindings

just for the sake of consistency, and clean up the code a bit.

16 months agoImprove and write Note about cascading specialization
Joachim Breitner [Tue, 20 Mar 2018 19:48:29 +0000 (15:48 -0400)] 
Improve and write Note about cascading specialization

16 months agoCreate stronger ArgOccs from calls to specialized functions
Joachim Breitner [Tue, 20 Mar 2018 17:42:59 +0000 (13:42 -0400)] 
Create stronger ArgOccs from calls to specialized functions

16 months agoFix seq# case of exprOkForSpeculation
Simon Peyton Jones [Tue, 20 Mar 2018 16:30:01 +0000 (16:30 +0000)] 
Fix seq# case of exprOkForSpeculation

This subtle patch fixes Trac #5129 (again; comment:20
and following).

I took the opportunity to document seq# properly; see
Note [seq# magic] in PrelRules, and Note [seq# and expr_ok]
in CoreUtils.

16 months agoRevert "rts, base: Refactor stats.c to improve --machine-readable report"
Ben Gamari [Tue, 20 Mar 2018 16:17:43 +0000 (12:17 -0400)] 
Revert "rts, base: Refactor stats.c to improve --machine-readable report"

This reverts commit 2d4bda2e4ac68816baba0afab00da6f769ea75a7.

16 months agoUpdate T5129 test:
Ömer Sinan Ağacan [Tue, 20 Mar 2018 07:48:14 +0000 (10:48 +0300)] 
Update T5129 test:

- Add some comments
- Remove $s as they complicate desugarer output for no reason
- Remove an indirection, case_negative is now main

16 months agoconfigure: Accept version suffix in solaris name
Ben Gamari [Mon, 19 Mar 2018 17:32:14 +0000 (13:32 -0400)] 
configure: Accept version suffix in solaris name

Summary: OpenIndiana apparently reports a triple of i386-pc-solaris2.11.

Reviewers: hvr

Subscribers: rwbarton, thomie, erikd, carter

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

16 months agorelnotes: Fix parsing of Version: field from Cabal file
Ben Gamari [Mon, 19 Mar 2018 17:31:46 +0000 (13:31 -0400)] 
relnotes: Fix parsing of Version: field from Cabal file

Subscribers: rwbarton, thomie, carter

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

16 months agoBump autoconf version bound to >= 2.69
Ben Gamari [Mon, 19 Mar 2018 17:31:31 +0000 (13:31 -0400)] 
Bump autoconf version bound to >= 2.69

Reviewers: hvr

Subscribers: rwbarton, thomie, erikd, carter

GHC Trac Issues: #14910

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

16 months agoAdd -flate-specialise which runs a later specialisation pass
Matthew Pickering [Mon, 19 Mar 2018 17:29:14 +0000 (13:29 -0400)] 
Add -flate-specialise which runs a later specialisation pass

Runs another specialisation pass towards the end of the optimisation
pipeline. This can catch specialisation opportunities which arose from
the previous specialisation pass or other inlining.

You might want to use this if you are you have a type class method
which returns a constrained type. For example, a type class where one
of the methods implements a traversal.

It is not enabled by default or any optimisation level. Only by
manually enabling the flag `-flate-specialise`.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

16 months agorts, base: Refactor stats.c to improve --machine-readable report
Douglas Wilson [Mon, 19 Mar 2018 17:26:41 +0000 (13:26 -0400)] 
rts, base: Refactor stats.c to improve --machine-readable report

There should be no change in the output of the '+RTS -s' (summary)
report, or the 'RTS -t' (one-line) report.

All data shown in the summary report is now shown in the machine
readable report.

All data in RTSStats is now shown in the machine readable report.

init times are added to RTSStats and added to GHC.Stats.

Example of the new output:
```
 [("bytes allocated", "375016384")
 ,("num_GCs", "113")
 ,("average_bytes_used", "148348")
 ,("max_bytes_used", "206552")
 ,("num_byte_usage_samples", "2")
 ,("peak_megabytes_allocated", "6")
 ,("init_cpu_seconds", "0.001642")
 ,("init_wall_seconds", "0.001027")
 ,("mut_cpu_seconds", "3.020166")
 ,("mut_wall_seconds", "0.757244")
 ,("GC_cpu_seconds", "0.037750")
 ,("GC_wall_seconds", "0.009569")
 ,("exit_cpu_seconds", "0.000890")
 ,("exit_wall_seconds", "0.002551")
 ,("total_cpu_seconds", "3.060452")
 ,("total_wall_seconds", "0.770395")
 ,("major_gcs", "2")
 ,("allocated_bytes", "375016384")
 ,("max_live_bytes", "206552")
 ,("max_large_objects_bytes", "159344")
 ,("max_compact_bytes", "0")
 ,("max_slop_bytes", "59688")
 ,("max_mem_in_use_bytes", "6291456")
 ,("cumulative_live_bytes", "296696")
 ,("copied_bytes", "541024")
 ,("par_copied_bytes", "493976")
 ,("cumulative_par_max_copied_bytes", "104104")
 ,("cumulative_par_balanced_copied_bytes", "274456")
 ,("fragmentation_bytes", "2112")
 ,("alloc_rate", "124170795")
 ,("productivity_cpu_percent", "0.986838")
 ,("productivity_wall_percent", "0.982935")
 ,("bound_task_count", "1")
 ,("sparks_count", "5836258")
 ,("sparks_converted", "237")
 ,("sparks_overflowed", "1990408")
 ,("sparks_dud ", "0")
 ,("sparks_gcd", "3455553")
 ,("sparks_fizzled", "390060")
 ,("work_balance", "0.555606")
 ,("n_capabilities", "4")
 ,("task_count", "10")
 ,("peak_worker_count", "9")
 ,("worker_count", "9")
 ,("gc_alloc_block_sync_spin", "162")
 ,("gc_alloc_block_sync_yield", "0")
 ,("gc_alloc_block_sync_spin", "162")
 ,("gc_spin_spin", "18840855")
 ,("gc_spin_yield", "10355")
 ,("mut_spin_spin", "70331392")
 ,("mut_spin_yield", "61700")
 ,("waitForGcThreads_spin", "241")
 ,("waitForGcThreads_yield", "2797")
 ,("whitehole_gc_spin", "0")
 ,("whitehole_lockClosure_spin", "0")
 ,("whitehole_lockClosure_yield", "0")
 ,("whitehole_executeMessage_spin", "0")
 ,("whitehole_threadPaused_spin", "0")
 ,("any_work", "1667")
 ,("no_work", "1662")
 ,("scav_find_work", "1026")
 ,("gen_0_collections", "111")
 ,("gen_0_par_collections", "111")
 ,("gen_0_cpu_seconds", "0.036126")
 ,("gen_0_wall_seconds", "0.036126")
 ,("gen_0_max_pause_seconds", "0.036126")
 ,("gen_0_avg_pause_seconds", "0.000081")
 ,("gen_0_sync_spin", "21")
 ,("gen_0_sync_yield", "0")
 ,("gen_1_collections", "2")
 ,("gen_1_par_collections", "1")
 ,("gen_1_cpu_seconds", "0.001624")
 ,("gen_1_wall_seconds", "0.001624")
 ,("gen_1_max_pause_seconds", "0.001624")
 ,("gen_1_avg_pause_seconds", "0.000272")
 ,("gen_1_sync_spin", "3")
 ,("gen_1_sync_yield", "0")
 ]
```

Test Plan: Ensure that one-line and summary reports are unchanged.

Reviewers: bgamari, erikd, simonmar, hvr

Reviewed By: simonmar

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14660

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

16 months agogen-data-layout.sh: Use bash array for readability
John Ericson [Mon, 19 Mar 2018 17:24:46 +0000 (13:24 -0400)] 
gen-data-layout.sh: Use bash array for readability

Reviewers: angerman, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

16 months agoFix typo
Gabor Greif [Thu, 8 Mar 2018 11:13:08 +0000 (12:13 +0100)] 
Fix typo

16 months agoFix typo in user guide about ConstraintKinds
Frank Steffahn [Tue, 13 Mar 2018 22:29:04 +0000 (23:29 +0100)] 
Fix typo in user guide about ConstraintKinds

The backslash currently in this type signature makes no sense. Without it, the example is fine.

16 months agoBump array submodule
Ben Gamari [Mon, 19 Mar 2018 16:46:44 +0000 (12:46 -0400)] 
Bump array submodule

16 months agoUpdate tests for #12870 to pass with a slow run of the testsuite.
Andreas Klebinger [Mon, 19 Mar 2018 16:06:54 +0000 (12:06 -0400)] 
Update tests for #12870 to pass with a slow run of the testsuite.

Test Plan: make slow

Reviewers: bgamari, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #12870

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

16 months agoDon't permit data types with return kind Constraint
Ryan Scott [Mon, 19 Mar 2018 16:06:41 +0000 (12:06 -0400)] 
Don't permit data types with return kind Constraint

Previously, GHC allowed all of the following:

```lang=haskell
data Foo1 :: Constraint
data family Foo2 :: Constraint
data family Foo3 :: k
data instance Foo3 :: Constraint
```

Yikes! This is because GHC was confusing `Type` with `Constraint`
due to careless use of the `isLiftedTypeKind` function. To respect
this distinction, I swapped `isLiftedTypeKind` out for
`tcIsStarKind`—which does respect this distinction—in the right
places.

Test Plan: make test TEST="T14048a T14048b T14048c"

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: goldfire, rwbarton, thomie, carter

GHC Trac Issues: #14048

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

16 months agoFix #14934 by including axSub0R in typeNatCoAxiomRules
Ryan Scott [Mon, 19 Mar 2018 16:05:36 +0000 (12:05 -0400)] 
Fix #14934 by including axSub0R in typeNatCoAxiomRules

For some reason, `axSub0R` was left out of `typeNatCoAxiomRules` in
`TcTypeNats`, which led to disaster when trying to look up `Sub0R` from
an interface file, as demonstrated in #14934.

The fix is simple—just add `axSub0R` to that list. To help prevent
an issue like this happening in the future, I added a
`Note [Adding built-in type families]` to `TcTypeNats`, which
contains a walkthrough of all the definitions in `TcTypeNats` you
need to update when adding a new built-in type family.

Test Plan: make test TEST=T14934

Reviewers: bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #14934

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

16 months agoRequire GHC 8.2 to bootstrap GHC
Joachim Breitner [Mon, 19 Mar 2018 16:05:22 +0000 (12:05 -0400)] 
Require GHC 8.2 to bootstrap GHC

Reviewers: bgamari, hvr, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: RyanGlScott, rwbarton, thomie, erikd, carter

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

16 months agoTurn a TH Name for built-in syntax into an unqualified RdrName
Chaitanya Koparkar [Mon, 19 Mar 2018 16:04:03 +0000 (12:04 -0400)] 
Turn a TH Name for built-in syntax into an unqualified RdrName

Previously, the Renamer would turn any fully qualified Template Haskell
name into a corresponding fully qualified `RdrName`. But this is not
what we want for built-in syntax, as it produces unnecessarily qualified
names (eg. GHC.Types.[], GHC.Tuple.(,) etc.).

Test Plan: ./validate

Reviewers: RyanGlScott, bgamari, goldfire

Reviewed By: RyanGlScott, bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #13776

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

16 months agoImplement equalKeysUFM the right way
David Feuer [Mon, 19 Mar 2018 16:03:36 +0000 (12:03 -0400)] 
Implement equalKeysUFM the right way

Originally, we compared the key lists, which was kind of silly.
Then I changed it to something fancier ... and also silly.
This is much more reasonable, should be faster, and is nice and
clear.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

16 months agoCmmUtils: get rid of insertBlock
Michal Terepeta [Mon, 19 Mar 2018 16:03:20 +0000 (12:03 -0400)] 
CmmUtils: get rid of insertBlock

`Hoopl.Graph` has almost exactly the same function, so let's use that.
Also, use `IntMap.alter` to make it more efficient.

Also switch `Hoopl` to use strict maps.

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
Test Plan: ./validate

Reviewers: bgamari, simonmar

Reviewed By: bgamari

Subscribers: dfeuer, rwbarton, thomie, carter

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

16 months agoImprove accuracy of get/setAllocationCounter
Ben Gamari [Mon, 19 Mar 2018 16:02:43 +0000 (12:02 -0400)] 
Improve accuracy of get/setAllocationCounter

Summary:
get/setAllocationCounter didn't take into account allocations in the
current block. This was known at the time, but it turns out to be
important to have more accuracy when using these in a fine-grained
way.

Test Plan:
New unit test to test incrementally larger allocaitons.  Before I got
results like this:

```
+0
+0
+0
+0
+0
+4096
+0
+0
+0
+0
+0
+4064
+0
+0
+4088
+4056
+0
+0
+0
+4088
+4096
+4056
+4096
```

Notice how the results aren't always monotonically increasing.  After
this patch:

```
+344
+416
+488
+560
+632
+704
+776
+848
+920
+992
+1064
+1136
+1208
+1280
+1352
+1424
+1496
+1568
+1640
+1712
+1784
+1856
+1928
+2000
+2072
+2144
```

Reviewers: hvr, erikd, simonmar, jrtc27, trommler

Reviewed By: simonmar

Subscribers: trommler, jrtc27, rwbarton, thomie, carter

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

16 months ago[RFC] nativeGen: Add support for MO_SS_Conv_W32_W64 on i386
Ben Gamari [Mon, 19 Mar 2018 16:02:29 +0000 (12:02 -0400)] 
[RFC] nativeGen: Add support for MO_SS_Conv_W32_W64 on i386

This is required by D4288. However, this only handles i386; we will
likely also need to do the same for PPC and SPARC, lest they break when
D4288 is re-merged.

Test Plan: Validate

Reviewers: simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie, carter

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

16 months agoSPARC nativeGen: Support for MO_SS_Conv_W32_W64
Peter Trommler [Mon, 19 Mar 2018 16:02:03 +0000 (12:02 -0400)] 
SPARC nativeGen: Support for MO_SS_Conv_W32_W64

Support for signed conversion from 32 bit to 64 bit
integers is required by D4363.

Test Plan: validate (perhaps also on SPARC)

Reviewers: simonmar, bgamari, kgardas, jrtc27

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

16 months agoPPC nativeGen: Add support for MO_SS_Conv_W32_W64
Peter Trommler [Mon, 19 Mar 2018 16:01:37 +0000 (12:01 -0400)] 
PPC nativeGen: Add support for MO_SS_Conv_W32_W64

This is required by D4363. D4362 has the implementation for i386
this commit adds PowerPC.

Test Plan: validate

Reviewers: erikd, hvr, simonmar, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

16 months agoImplement -dword-hex-literals
Andrew Martin [Mon, 19 Mar 2018 16:01:17 +0000 (12:01 -0400)] 
Implement -dword-hex-literals

Provide flag for showing showing Word# and Word64# as hexadecimal when
dumping GHC core.  The only affects Word, not Int, and it prefixes the
hexadecimal with enough zeroes to make the total character count a power
of two. For example:

- 0x0C0C instead of 0xC0C
- 0x00BA00BA instead of 0xBA00BA

This also affects the presentation of Word# and Word64# in GHC's error
messages. It is not expected that the flag will be used for this, but
it is a side-effect worth noting.

Test Plan: none

Reviewers: bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, mpickering, rwbarton, thomie, carter, andrewthad

GHC Trac Issues: #14872

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

16 months agoHoopl: improve postorder calculation
Michal Terepeta [Mon, 19 Mar 2018 15:58:54 +0000 (11:58 -0400)] 
Hoopl: improve postorder calculation

- Fix the naming and comments to indicate that we are calculating
  *reverse* postorder (and not the standard postorder).

- Rewrite the calculation to avoid CPS code. I found it fairly
  difficult to understand and the new one seems faster (according to
  nofib, decreases compiler allocations by 0.2%)

- Remove `LabelsPtr`, which seems unnecessary and could be *really*
  confusing. For instance, previously:
  `postorder_dfs_from <block with label X>`
  and
  `postorder_dfs_from <label X>`
  would actually mean quite different things (and give different
  results).

- Change the `Dataflow` module to always use entry of the graph for
  reverse postorder calculation. This should be the only change in
  behavior of this commit.

  Previously, if the caller provided initial facts for some of the
  labels, we would use those labels for our postorder calculation.
  However, I don't think that's correct in general - if the initial
  facts did not contain the entry of the graph, we would never analyze
  the blocks reachable from the entry but unreachable from the labels
  provided with the initial facts. It seems that the only analysis that
  used this was proc-point analysis, which I think would always include
  the entry block (so I don't think there's any bug due to this).

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
Test Plan: ./validate

Reviewers: bgamari, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie, carter

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

16 months agoGet rid of more CPP in cmm/ and codeGen/
Michal Terepeta [Mon, 19 Mar 2018 15:58:39 +0000 (11:58 -0400)] 
Get rid of more CPP in cmm/ and codeGen/

This removes a bunch of unnecessary includes of `HsVersions.h` along
with unnecessary CPP (e.g., due to checking for DEBUG which can be
achieved by looking at `debugIsOn`)

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
Test Plan: ./validate

Reviewers: bgamari, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

16 months agoImprove the warning message of qualified unused imports.
HE, Tao [Mon, 19 Mar 2018 15:58:26 +0000 (11:58 -0400)] 
Improve the warning message of qualified unused imports.

Pretty-print unused imported names unqualified unconditionally to
make the warning message consistent for ambiguous/unambiguous
identifiers.

Signed-off-by: HE, Tao <sighingnow@gmail.com>
Test Plan: make test TEST="T14881"

Reviewers: bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #14881

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

16 months agoBe more selective in which conditionals we invert
Simon Marlow [Mon, 19 Mar 2018 15:57:27 +0000 (11:57 -0400)] 
Be more selective in which conditionals we invert

Test Plan: validate

Reviewers: bgamari, AndreasK, erikd

Reviewed By: AndreasK

Subscribers: rwbarton, thomie, carter

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

16 months agoAlso check local rules with -frules-check
Matthew Pickering [Mon, 19 Mar 2018 15:57:06 +0000 (11:57 -0400)] 
Also check local rules with -frules-check

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

16 months agorts: Add --internal-counters RTS flag and several counters
Douglas Wilson [Mon, 19 Mar 2018 15:55:37 +0000 (11:55 -0400)] 
rts: Add --internal-counters RTS flag and several counters

The existing internal counters:
* gc_alloc_block_sync
* whitehole_spin
* gen[g].sync
* gen[1].sync

are now not shown in the -s report unless --internal-counters is also passed.

If --internal-counters is passed we now show the counters above, reformatted, as
well as several other counters. In particular, we now count the yieldThread()
calls that SpinLocks do as well as their spins.

The added counters are:
* gc_spin (spin and yield)
* mut_spin (spin and yield)
* whitehole_threadPaused (spin only)
* whitehole_executeMessage (spin only)
* whitehole_lockClosure (spin only)
* waitForGcThreadsd (spin and yield)

As well as the following, which are not SpinLock-like things:
* any_work
* do_work
* scav_find_work

See the Note for descriptions of what these counters are.

We add busy_wait_nops in these loops along with the counter increment where it
was absent.

Old internal counters output:
```
gc_alloc_block_sync: 0
whitehole_gc_spin: 0
gen[0].sync: 0
gen[1].sync: 0
```

New internal counters output:
```
Internal Counters:
                                           Spins        Yields
    gc_alloc_block_sync                      323             0
    gc_spin                              9016713           752
    mut_spin                            57360944         47716
    whitehole_gc                               0           n/a
    whitehole_threadPaused                     0           n/a
    whitehole_executeMessage                   0           n/a
    whitehole_lockClosure                      0             0
    waitForGcThreads                           2           415
    gen[0].sync                                6             0
    gen[1].sync                                1             0

    any_work                                2017
    no_work                                 2014
    scav_find_work                          1004
```

Test Plan:
./validate

Check it builds with #define PROF_SPIN removed from includes/rts/Config.h

Reviewers: bgamari, erikd, simonmar, hvr

Reviewed By: simonmar

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #3553, #9221

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

16 months agoAdd a build with 32bit Ubuntu container
mrkkrp [Wed, 28 Feb 2018 11:18:58 +0000 (18:18 +0700)] 
Add a build with 32bit Ubuntu container

16 months agoUpdate test for #5129:
Ömer Sinan Ağacan [Mon, 19 Mar 2018 12:46:44 +0000 (15:46 +0300)] 
Update test for #5129:

Make sure it runs with --fast validate with correct optimisation
settings (-O1 or above) so that it actually tests the bug.

Because the bug is in the simplifier running it with -O0 doesn't
test it.

16 months agoComments and tiny refactor
Simon Peyton Jones [Mon, 19 Mar 2018 09:39:58 +0000 (09:39 +0000)] 
Comments and tiny refactor

Related to Ryan's upcoming patch for Trac #14933

16 months agoaclocal.m4: add OSHurd (debian patch)
Sergei Trofimovich [Sat, 17 Mar 2018 17:12:04 +0000 (17:12 +0000)] 
aclocal.m4: add OSHurd (debian patch)

ghc treats OSUnknown (and GNU/Hurd) as non-ELF target.
This causes panic in native codegenerator when trying
to build PIC code:

```
  ...
  -- all other platforms
  howToAccessLabel dflags _ _ _ _ _
        | not (positionIndependent dflags)
        = AccessDirectly
        | otherwise
        = panic "howToAccessLabel: PIC not defined for this platform"
```

This change declares new 'OSHurd' and marks it as an
ELF target. Fixes building ghc-stage2 on i686-unknown-gnu0.9.

Patch provided by "Pino" via Samuel Thibault and taken from
debian.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
16 months agoaclocal.m4: allow more GNU/Hurd tuples
Sergei Trofimovich [Sat, 17 Mar 2018 12:12:43 +0000 (12:12 +0000)] 
aclocal.m4: allow more GNU/Hurd tuples

Running plain ./configure fails on hurd because
./config.guess reports unrecognised tuple:
    $ ./config.guess
    i686-unknown-gnu0.9

The change makes the following target configure:
$ ./configure --target=i686-unknown-gnu0.9

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
16 months agoSlighly improve infix con app pattern errors
Ömer Sinan Ağacan [Wed, 14 Mar 2018 06:16:51 +0000 (09:16 +0300)] 
Slighly improve infix con app pattern errors

Given this program:

    main = do
      f $ do
        a <- return 3
          c <- do
          return 5

GHC previously gave this error message:

    Main.hs:2:7: error:
        Parse error in pattern: do a <- return 3 c
        Possibly caused by a missing 'do'?
      |
    2 |   f $ do
      |       ^^...

What happened is GHC considered the whole `f $ do a <- return 3 c` as a
pattern. When parsed as an expression it becomes an infix application of
`($)`, and GHC checks left and right hand sides before checking if `($)`
is a valid infix constructor name, and shows the first error it got.

If instead we first check if the infix op is valid in pattern context,
the error message becomes much clearer:

    Main.hs:2:3: error:
        Parse error in pattern: f $ do a <- return 3 c
        Possibly caused by a missing 'do'?
      |
    2 |   f $ do
      |   ^^^^^^...

This may not entirely fix #11188 but I think it's an improvement.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #11188

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

16 months agoDrop GHC 8.0 compatibility
Ryan Scott [Tue, 13 Mar 2018 17:36:38 +0000 (13:36 -0400)] 
Drop GHC 8.0 compatibility

GHC 8.4.1 is out, so now GHC's support window only extends
back to GHC 8.2. This means we can delete gobs of code that were
only used for GHC 8.0 support. Hooray!

Test Plan: ./validate

Reviewers: bgamari, erikd, dfeuer

Reviewed By: bgamari, dfeuer

Subscribers: alexbiehl, dfeuer, rwbarton, thomie, carter

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

16 months agoUpdate a comment in Exception.cmm
Ömer Sinan Ağacan [Tue, 13 Mar 2018 12:34:21 +0000 (15:34 +0300)] 
Update a comment in Exception.cmm

[skip ci]

16 months agoComment improvements on interpreter breakpoint IO action
Ömer Sinan Ağacan [Tue, 13 Mar 2018 12:25:53 +0000 (15:25 +0300)] 
Comment improvements on interpreter breakpoint IO action

[skip ci]

16 months agoBump Cabal submodule
Ben Gamari [Sat, 10 Mar 2018 18:47:51 +0000 (13:47 -0500)] 
Bump Cabal submodule

16 months agoRemove splitEithers, use partitionEithers from base
Ömer Sinan Ağacan [Mon, 12 Mar 2018 07:54:17 +0000 (10:54 +0300)] 
Remove splitEithers, use partitionEithers from base

16 months agotestsuite: disable T13615 on non-smp targets
Sergei Trofimovich [Sat, 10 Mar 2018 12:33:59 +0000 (12:33 +0000)] 
testsuite: disable T13615 on non-smp targets

T13615 needs multicore support from RTS:
    T13615: unknown RTS option: -N15

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
16 months agoFix a debug print in disassembler (#14905)
Ömer Sinan Ağacan [Fri, 9 Mar 2018 12:38:58 +0000 (15:38 +0300)] 
Fix a debug print in disassembler (#14905)

When interpreter is not profiled (see `interpreterProfiled` in
`DynFlags`) bytecode generator generates a NULL pointer as the cost
centre of a `BRK_FUN` instruction:

    let cc | interpreterProfiled dflags = cc_arr ! tick_no
           | otherwise = toRemotePtr nullPtr
    let breakInstr = BRK_FUN (fromIntegral tick_no) (getUnique this_mod) cc
    return $ breakInstr `consOL` code

We now take this into account when disassembling `BRK_FUN`.

Reviewers: bgamari, simonmar, erikd

Subscribers: rwbarton, thomie, carter

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

16 months agoUNREG: fix implicit declarations from pdep and pext
Sergei Trofimovich [Fri, 9 Mar 2018 17:43:01 +0000 (17:43 +0000)] 
UNREG: fix implicit declarations from pdep and pext

Unreg build failed as:

  $ ./configure --enable-unregisterised
  $ make

  HC [stage 1] libraries/ghc-prim/dist-install/build/GHC/PrimopWrappers.o
    ghc_1.hc: In function 'ghczmprim_GHCziPrimopWrappers_pdep8zh_entry':

    ghc_1.hc:1810:9: error:
     error: implicit declaration of function 'hs_pdep8'; did you mean 'hs_ctz8'?
       [-Werror=implicit-function-declaration]
     _c3jz = hs_pdep8(*Sp, Sp[1]);
             ^~~~~~~~
             hs_ctz8
       |
  1810 | _c3jz = hs_pdep8(*Sp, Sp[1]);
       |         ^

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
16 months agoCompacted arrays are pinned for isByteArrayPinned#
Simon Marlow [Thu, 8 Mar 2018 08:54:01 +0000 (08:54 +0000)] 
Compacted arrays are pinned for isByteArrayPinned#

Test Plan: New unit test

Reviewers: andrewthad, niteria, bgamari, erikd

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14900

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

16 months agoconfigure: Accept suffix in OpenBSD triple's OS name
Ben Gamari [Thu, 8 Mar 2018 18:29:01 +0000 (13:29 -0500)] 
configure: Accept suffix in OpenBSD triple's OS name

Reviewers: hvr

Subscribers: rwbarton, thomie, erikd, carter

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

16 months agoRemove outdated documentation bits concerning -Wmissing-methods
Ryan Scott [Thu, 8 Mar 2018 18:23:27 +0000 (13:23 -0500)] 
Remove outdated documentation bits concerning -Wmissing-methods

In commit 503219e3e1667ac39607021b2d9586260fbab32b, we
stopped suppressing `-Wmissing-methods` warnings on class methods
whose names begin with an underscore. However, it seems the users'
guide documentation concerning this was never updated. Let's do so.

Test Plan: Read it

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #12959

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

16 months agoghc-prim: Silence -Wsync-nand warning in atomic.c
Ben Gamari [Thu, 8 Mar 2018 18:22:37 +0000 (13:22 -0500)] 
ghc-prim: Silence -Wsync-nand warning in atomic.c

GCC throws this warning to inform us that __sync_fetch_and_nand's
behavior changed in GCC 4.4. However, this causes the build to fail when
-Werror is used.

Test Plan: Validate with -Werror

Subscribers: rwbarton, thomie, carter

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

16 months agoghc-prim: Reduce scope of Clang sync_fetch_and_nand workaround
Ben Gamari [Thu, 8 Mar 2018 18:22:22 +0000 (13:22 -0500)] 
ghc-prim: Reduce scope of Clang sync_fetch_and_nand workaround

As described in https://bugs.llvm.org/show_bug.cgi?id=8842, Clang
removed the __sync_fetch_and_nand builtins due to inconsistency in GCC's
behavior in 2010.  However, GCC has since clarified the behavior of
their builtins and consequently Clang re-added them in 2014.
Consequently this workaround should no longer be necessary.

Test Plan: Validate building with Clang

Subscribers: rwbarton, thomie, carter

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

16 months agoError message and doc improvements for #14335
Ömer Sinan Ağacan [Thu, 8 Mar 2018 18:19:33 +0000 (13:19 -0500)] 
Error message and doc improvements for #14335

- Show a more friendly error message when -fplugin is used with
  -fexternal-interpreter

- Add a few words to users guide about the interaction with -fplugin and
  -fexternal-interpreter

- Update test for #14335

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14335

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

16 months agoRevert "GHCi: Don't remove shadowed bindings from typechecker scope."
Ömer Sinan Ağacan [Thu, 8 Mar 2018 18:42:22 +0000 (21:42 +0300)] 
Revert "GHCi: Don't remove shadowed bindings from typechecker scope."

This reverts commit 59d7ee53906b9cee7f279c1f9567af7b930f8636 and enables
the test for #14052.

(See #14052 for the discussion)

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14052

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

16 months agoAdd -fexternal-dynamic-refs
Simon Marlow [Wed, 28 Feb 2018 19:03:37 +0000 (11:03 -0800)] 
Add -fexternal-dynamic-refs

Summary:
The `-dynamic` flag does two things:

* In the code generator, it generates code designed to link against
  external shared libraries.  References outside of the current module
  go through platform-specific indirection tables (e.g. the GOT on ELF).

* It enables a "way", which changes which hi files we look
  for (`Foo.dyn_hi`) and which libraries we link against.

Some specialised applications want the first of these without the
second. (I could go into detail here but it's probably not all that
important).

This diff splits out the code-generation effects of `-dynamic` from the
"way" parts of its behaviour, via a new flag `-fexternal-dynamic-refs`.

Test Plan: validate

Reviewers: niteria, bgamari, erikd

Subscribers: rwbarton, thomie, carter

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

16 months agoFix typo in description of -V RTS flag
Tej Chajed [Tue, 6 Mar 2018 18:46:01 +0000 (13:46 -0500)] 
Fix typo in description of -V RTS flag

16 months agoUsers Guide: Add that --numa is available on Windows too
Simon Jakobi [Mon, 5 Mar 2018 05:19:20 +0000 (06:19 +0100)] 
Users Guide: Add that --numa is available on Windows too

Windows support was added in c93813d96b1da53a2ebd9c9ac5af6cc3e3443c43

16 months agoFix a typo about pattern synonyms in documentation.
HE, Tao [Mon, 5 Mar 2018 15:52:29 +0000 (23:52 +0800)] 
Fix a typo about pattern synonyms in documentation.

16 months agoUse docker images with non-root user
mrkkrp [Wed, 28 Feb 2018 09:33:59 +0000 (16:33 +0700)] 
Use docker images with non-root user

That image creates an unprivileged user to run the test suite under.

16 months agoSchedule.c: remove unreachable code block
Ömer Sinan Ağacan [Wed, 7 Mar 2018 11:34:46 +0000 (14:34 +0300)] 
Schedule.c: remove unreachable code block

16 months agoAdd bindist-list.uniq to .gitignore
Ömer Sinan Ağacan [Wed, 7 Mar 2018 10:01:20 +0000 (13:01 +0300)] 
Add bindist-list.uniq to .gitignore

16 months agoAdd perf test for #14052
Ömer Sinan Ağacan [Wed, 7 Mar 2018 08:52:05 +0000 (11:52 +0300)] 
Add perf test for #14052

16 months agoFix interpreter with profiling
Simon Marlow [Mon, 5 Mar 2018 20:12:57 +0000 (15:12 -0500)] 
Fix interpreter with profiling

This was broken by D3746 and/or D3809, but unfortunately we didn't
notice because CI at the time wasn't building the profiling way.

Test Plan:
```
cd testsuite/test/profiling/should_run
make WAY=ghci-ext-prof
```

Reviewers: bgamari, michalt, hvr, erikd

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14705

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

16 months agoBump nofib submodule
Ben Gamari [Mon, 5 Mar 2018 20:30:25 +0000 (15:30 -0500)] 
Bump nofib submodule

16 months agoMake accumArray and accum stricter
David Feuer [Mon, 5 Mar 2018 20:18:05 +0000 (15:18 -0500)] 
Make accumArray and accum stricter

`accumArray` was lazier than documented. `accum` did not have
documented strictness. The extra laziness allowed thunks to build
up in the array. Force the results of applying the accumulating
function to resolve.

Reviewers: hvr, bgamari

Reviewed By: bgamari

Subscribers: alpmestan, rwbarton, thomie, carter

GHC Trac Issues: #14785

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

16 months agocmm/: Avoid using lazy left folds
Michal Terepeta [Mon, 5 Mar 2018 20:16:02 +0000 (15:16 -0500)] 
cmm/: Avoid using lazy left folds

This basically replaces all uses of `foldl` with `foldl'`. I've looked
at all the call sites and there doesn't seem to be any reason to prefer
the lazy version.

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
Test Plan: ./validate

Reviewers: bgamari, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

16 months agoCorrect -g flag description
Bartosz Nitka [Mon, 5 Mar 2018 19:10:11 +0000 (11:10 -0800)] 
Correct -g flag description

Since 7aaeaf81ea95c36fe1dc4da449cf6092a792fd09
`-g1` and `-g2` are actually different.
The tutorial below is correct.

Test Plan: harbormaster

Reviewers: bgamari, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

16 months agoAllow top level ticked string literals
Bartosz Nitka [Fri, 2 Mar 2018 13:33:07 +0000 (05:33 -0800)] 
Allow top level ticked string literals

This reverts f5b275a239d2554c4da0b7621211642bf3b10650
and changes the places that looked for `Lit (MachStr _))`
to use `exprIsMbTickedLitString_maybe` to unwrap ticks as
necessary.
Also updated relevant comments.

Test Plan:
I added 3 new tests that previously reproduced.
GHC HEAD now builds with -g

Reviewers: simonpj, simonmar, bgamari, hvr, goldfire

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14779

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

16 months agoSchedule.c: remove a redundant CPP guard
Ömer Sinan Ağacan [Tue, 6 Mar 2018 11:16:00 +0000 (14:16 +0300)] 
Schedule.c: remove a redundant CPP guard

(the CPP guard is already wrapped with the same guard in line 1549)

16 months agoadd CCX=$(CXX) to integer-gmp
Moritz Angermann [Tue, 6 Mar 2018 03:20:22 +0000 (11:20 +0800)] 
add CCX=$(CXX) to integer-gmp

Summary:
This came up when trying to build GHC HEAD with nix. We
do not set CCX for integer-gmp when running ./configure. We do
this however for libffi.

The result is, that if CCX is not set, we default to the system
one, of which there might be none (as in nixos's case).  This
will not show on a debian+nix or similar setup, where the system
`cxx` is still in place, and only shows up when the system tries
hard to sandbox everything (even cxx) as nixOS does.

We use `CXX`, which is set to either `clang` or `CC_STAGE1`, and
also usedfor `CC`, similar to what we do for libffi.c

Test Plan: ./validate

Reviewers: bgamari, hvr

Reviewed By: hvr

Subscribers: rwbarton, thomie, carter

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

16 months ago`--via-asm` only for windows targets
Moritz Angermann [Mon, 5 Mar 2018 09:18:25 +0000 (17:18 +0800)] 
`--via-asm` only for windows targets

Reviewers: trofi, bgamari

Reviewed By: trofi, bgamari

Subscribers: rwbarton, thomie, carter

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

16 months agoFixup include of gmp/config.mk to use new location
Herbert Valerio Riedel [Mon, 5 Mar 2018 20:13:28 +0000 (21:13 +0100)] 
Fixup include of gmp/config.mk to use new location

This wasn't spotted rightaway in
8f0b2f5eadf0fcb47c581907205a9db686214a69
because the include-site deliberately ignored include-errors as
a Hack with the justification below:

> Hack. The file gmp/config.mk doesn't exist yet after running ./configure in
> the toplevel (ghc) directory. To let some toplevel make commands such as
> sdist go through, right after ./configure, don't consider this an error.

This may have contributed to #14891.

16 months agoSimplify rnLHsInstType
Simon Peyton Jones [Mon, 5 Mar 2018 14:40:37 +0000 (14:40 +0000)] 
Simplify rnLHsInstType

This patch is preparatory for the main fix for Trac #13324

Here, we simplify rnLHsInstType so that it does not try
to figure out the class name.  This turns out to have a good
(rather than bad) effect on error messages, and it prepares
the way for the main event.

Plus, less code!

16 months agoFix #14888 by adding more special cases for ArrowT
Ryan Scott [Mon, 5 Mar 2018 13:57:04 +0000 (08:57 -0500)] 
Fix #14888 by adding more special cases for ArrowT

Summary:
There were previously some situations where `(->)` would
not be desugared or reified as `ArrowT`, leading to various oddities
such as those observed in #14888. We now uniformly treat `(->)` as
`ArrowT` in Template Haskell–world by checking for any tycon that
has the same name as `(->)`, and converting that to `ArrowT`.

Test Plan: make test TEST=T14888

Reviewers: goldfire, bgamari, simonpj

Reviewed By: goldfire, simonpj

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #14888

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

16 months agoRespect Note [The tcType invariant]
Simon Peyton Jones [Fri, 2 Mar 2018 17:26:58 +0000 (17:26 +0000)] 
Respect Note [The tcType invariant]

I tried to do this with

    commit 0a12d92a8f65d374f9317af2759af2b46267ad5c
    Author: Simon Peyton Jones <simonpj@microsoft.com>
    Date:   Wed Dec 13 12:53:26 2017 +0000

    Further improvements to well-kinded types

    The typechecker has the invariant that every type should be well-kinded
    as it stands, without zonking.  See Note [The well-kinded type invariant]
    in TcType.

    That invariant was not being upheld, which led to Trac #14174.  I fixed
    part of it, but T14174a showed that there was more.  This patch finishes
    the job.

But I didn't get it quite right as Trac #14873 showed.

This patch fixes the problem; although I am still a bit unhappy.
(See "A worry" in the HsApp case of tc_infer_hs_type.)

16 months agoWombling around in Trac #14808
Simon Peyton Jones [Fri, 2 Mar 2018 17:12:03 +0000 (17:12 +0000)] 
Wombling around in Trac #14808

Comment:4 in Trac #14808 explains why I'm unhappy with the current
state of affairs -- at least the lack of documentation.

This smallpatch does nothing major:

* adds comments
* uses existing type synonyms more (notably FreeKiTyVarsWithDups)
* adds another test case to T14808

16 months agoBump Cabal submodule
Ben Gamari [Sun, 4 Mar 2018 03:05:44 +0000 (22:05 -0500)] 
Bump Cabal submodule

16 months agoBump Cabal submodule to 2.2
Moritz Angermann [Sat, 3 Mar 2018 21:16:41 +0000 (16:16 -0500)] 
Bump Cabal submodule to 2.2

Requires some ghc-cabal changes as well.

Test Plan: ./validate

Reviewers: hvr, bgamari

Reviewed By: bgamari

Subscribers: hsyl20, erikd, alpmestan, rwbarton, thomie, carter

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

16 months agoBump hsc2hs submodule
Moritz Angermann [Sun, 4 Mar 2018 02:37:58 +0000 (10:37 +0800)] 
Bump hsc2hs submodule

This should have been part of 5f6fcf78.

16 months agoParenthesize (() :: Constraint) in argument position
Ryan Scott [Sat, 3 Mar 2018 18:48:38 +0000 (13:48 -0500)] 
Parenthesize (() :: Constraint) in argument position

Summary:
A simple oversight in the pretty-printer lead to a special
case for `() :: Constraint` not being parenthesized correctly when
used in an argument position. Easily fixed with a `maybeParen`.

Test Plan: make test TEST=T14796

Reviewers: alanz, goldfire, bgamari, simonpj

Reviewed By: bgamari, simonpj

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #14796

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

16 months agoFix the coverage checker's treatment of existential tyvars
Ryan Scott [Fri, 2 Mar 2018 21:18:04 +0000 (16:18 -0500)] 
Fix the coverage checker's treatment of existential tyvars

Previously, the pattern-match coverage checker was far too
eager to freshen the names of existentially quantified type
variables, which led to incorrect sets of type constraints that
misled GHC into thinking that certain programs that involve nested
GADT pattern matches were non-exhaustive (when in fact they were).
Now, we generate extra equality constraints in the ConCon case of
the coverage algorithm to ensure that these fresh tyvars align
with existing existential tyvars. See
`Note [Coverage checking and existential tyvars]` for the full story.

Test Plan: make test TEST="T11984 T14098"

Reviewers: gkaracha, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #11984, #14098

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

16 months agoCorrect default -A value in RTS flag usage info
Simon Jakobi [Fri, 2 Mar 2018 21:17:44 +0000 (16:17 -0500)] 
Correct default -A value in RTS flag usage info

Reviewers: bgamari, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

16 months agodoCorePass: Expand catch-all
Simon Jakobi [Fri, 2 Mar 2018 21:17:12 +0000 (16:17 -0500)] 
doCorePass: Expand catch-all

This doesn't remedy problem, but at least it's more explicit than
the catch-all

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14544

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

16 months agoCompile with `--via-asm` when cross compiling.
Moritz Angermann [Fri, 2 Mar 2018 21:16:52 +0000 (16:16 -0500)] 
Compile with `--via-asm` when cross compiling.

This bumps `hsc2hs` and adds the new `--via-asm` flag,
which allows to successfully cross compile the win32
lirbary.

- Compile with `--via-asm` when cross compiling. This requires
haskell/hsc2hs#5 (https://github.com/haskell/hsc2hs/pull/5)

Test Plan: ./validate

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

16 months agoFix #14838 by marking TH-spliced code as FromSource
Ryan Scott [Fri, 2 Mar 2018 21:16:17 +0000 (16:16 -0500)] 
Fix #14838 by marking TH-spliced code as FromSource

Previously, any Template Haskell code that was spliced would
be marked as `Generated`, which would completely suppress pattern-
match coverage warnings for it, which several folks found confusing.
Indeed, Template Haskell-spliced code is "source" code in some sense,
as users specifically request that it be put into their program, so
changing its designation to `FromSource` makes sense from that
perspective.

Test Plan: make test TEST=T14838

Reviewers: goldfire, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14838

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

16 months agoPermit conversion of partially applied PromotedTupleTs
Ryan Scott [Fri, 2 Mar 2018 21:15:38 +0000 (16:15 -0500)] 
Permit conversion of partially applied PromotedTupleTs

Summary:
We were simply missing a case in `Convert` for when have a
`PromotedTupleT` that wasn't fully saturated. Easily fixed.

Test Plan: make test TEST=T14843

Reviewers: goldfire, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14843

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

16 months agoAdds *-cross-ncg flavour.
Moritz Angermann [Fri, 2 Mar 2018 21:15:09 +0000 (16:15 -0500)] 
Adds *-cross-ncg flavour.

Our *-cross flavours force -fllvm, this adds flavours for cross
compilation to x86_64, where we can use our native code generator.

Test Plan: ./validate

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

16 months agoAdd Applicative, Semigroup, and Monoid instances in GHC.Generics
Lysxia [Fri, 2 Mar 2018 21:14:36 +0000 (16:14 -0500)] 
Add Applicative, Semigroup, and Monoid instances in GHC.Generics

Reviewers: hvr, bgamari, alpmestan, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: RyanGlScott, rwbarton, thomie, carter

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

16 months agoconfigure: Enable LD_NO_GOLD is set in all codepaths
Ben Gamari [Fri, 2 Mar 2018 21:13:53 +0000 (16:13 -0500)] 
configure: Enable LD_NO_GOLD is set in all codepaths

Test Plan: `./configure --disable-ld-override; make; make install`

Reviewers: trofi, hvr

Reviewed By: trofi

Subscribers: rwbarton, thomie, erikd, carter, simonmar

GHC Trac Issues: #14675

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

16 months agorts/win32: Assert that the IO manager has been initialised
Simon Jakobi [Fri, 2 Mar 2018 21:13:26 +0000 (16:13 -0500)] 
rts/win32: Assert that the IO manager has been initialised

Reviewers: bgamari, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

16 months agoAdd @since annotations for derived instances in base
Chaitanya Koparkar [Fri, 2 Mar 2018 21:12:56 +0000 (16:12 -0500)] 
Add @since annotations for derived instances in base

Test Plan: ./validate

Reviewers: hvr, goldfire, bgamari, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #11767

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

16 months agoImprove missing-home-modules warning formatting
Matthew Pickering [Fri, 2 Mar 2018 21:12:22 +0000 (16:12 -0500)] 
Improve missing-home-modules warning formatting

Previously the modules were smashed together at the end of the line. As
the header is quite long, this meant for quite long lines which wrapped
on smaller terminals.

err msg: A
         B

Now they are nested underneath the long first line of the error message.

err msg:
  A
  B

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

16 months agoGHCi info: Use src file for cache invalidation
alexbiehl [Fri, 2 Mar 2018 21:11:45 +0000 (16:11 -0500)] 
GHCi info: Use src file for cache invalidation

Prior to this patch GHCi used the modification time of a module's object
file to invalidate the info cache.

We now look at the modification time of the source file, if present.

This addresses part of
https://ghc.haskell.org/trac/ghc/ticket/12706#comment:3.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: lelf, alpmestan, rwbarton, thomie, carter

GHC Trac Issues: #12706

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

16 months agoDynFlags: Support British spelling of GeneralisedNewtypeDeriving
Ben Gamari [Fri, 2 Mar 2018 19:18:48 +0000 (14:18 -0500)] 
DynFlags: Support British spelling of GeneralisedNewtypeDeriving

Reviewers: dfeuer

Reviewed By: dfeuer

Subscribers: dfeuer, rwbarton, thomie, carter

GHC Trac Issues: #14819

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

16 months agoVarious Windows / Cross Compile to Windows fixes
Moritz Angermann [Fri, 2 Mar 2018 19:19:58 +0000 (14:19 -0500)] 
Various Windows / Cross Compile to Windows fixes

- Adds quick-cross-ncg flavour.
- Fix windows wchar with `_s` for mingw
- Lookup windres, dllwrap and objdump
- Fix type.

Reviewers: bgamari, hvr, Phyx, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, erikd, carter

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

16 months agoFix #14817 by not double-printing data family instance kind signatures
Ryan Scott [Fri, 2 Mar 2018 19:18:15 +0000 (14:18 -0500)] 
Fix #14817 by not double-printing data family instance kind signatures

Within `pprDataFamInstDecl`, we were invoking `pprFamInstLHS` to
pretty-print a data family instance header, and we were passing `Just` a
kind signature to `pprFamInstLHS` to make it pretty-print the kind
signature alongside it (this is a consequence of commit
d1ef223cfebd23c25489a4b0c67fbaa2f91c1ec6). But this is silly, because
then invoke `pp_data_defn`, which //also// pretty-prints the kind
signature, resulting in the kind signature being printed twice by
mistake.

This fix is simple—pass `Nothing` to `pprFamInstLHS` instead.

Test Plan: make test TEST=T14817

Reviewers: alanz, bgamari, mpickering

Reviewed By: mpickering

Subscribers: mpickering, rwbarton, thomie, carter

GHC Trac Issues: #14817

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

16 months agoAdd regression test for #12790
Ryan Scott [Fri, 2 Mar 2018 19:17:52 +0000 (14:17 -0500)] 
Add regression test for #12790

Test Plan: make test TEST=T12790

Reviewers: bgamari, mpickering

Reviewed By: mpickering

Subscribers: mpickering, dfeuer, rwbarton, thomie, carter

GHC Trac Issues: #12790

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

16 months agoImprove exhaustive checking for guards in pattern bindings and MultiIf.
HE, Tao [Fri, 2 Mar 2018 19:16:24 +0000 (14:16 -0500)] 
Improve exhaustive checking for guards in pattern bindings and MultiIf.

Previously we didn't do exhaustive checking on MultiIf expressions
and guards in pattern bindings.

We can construct the `LMatch` directly from GRHSs or [LHsExpr]
(MultiIf's alts) then feed it to checkMatches, without construct the
MatchGroup and using function `matchWrapper`.

Signed-off-by: HE, Tao <sighingnow@gmail.com>
Test Plan: make test TEST="T14773a T14773b"

Reviewers: bgamari, RyanGlScott, simonpj

Reviewed By: bgamari, simonpj

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14773

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

16 months agoMove Data.Functor.Contravariant from the contravariant package to base.
Andrew Martin [Fri, 2 Mar 2018 19:14:13 +0000 (14:14 -0500)] 
Move Data.Functor.Contravariant from the contravariant package to base.

Move Data.Functor.Contravariant from the contravariant package to base.
Since base is the bottom of the dependency hierarchy, several instances
have been removed. They will need to be added to the following packages:
transformers, StateVar, and possibly tagged. There may not actually have
been any types from tagged that previous had instanced provided by this
module though, since it may have only been used for Data.Proxy. Additionally,
all CPP has been removed. Derived Typeable instances have been removed
(since Typeable is now automatically derived for everything). The language
extension Safe is still used, although it is unclear to ATM whether or not
it is necessary.

This resolves trac issue #14767.

Test Plan: validate

Reviewers: RyanGlScott, ekmett, hvr, bgamari

Reviewed By: RyanGlScott

Subscribers: rwbarton, thomie, ekmett, carter, RyanGlScott

GHC Trac Issues: #14767

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