4 years agoPut Opt_Static into defaultFlags if not pc_DYNAMIC_BY_DEFAULT (#7478)
Bernhard Herzog [Thu, 16 Jul 2015 22:04:05 +0000 (00:04 +0200)] 
Put Opt_Static into defaultFlags if not pc_DYNAMIC_BY_DEFAULT (#7478)

The test for Trac issue #7478 fails on some systems due to
inconsistent default flags for dynamic vs. static linking.

Test Plan: validate

Reviewers: austin, thomie

Reviewed By: thomie

Subscribers: thomie, bgamari

Differential Revision:

GHC Trac Issues: #7478

4 years agoImplement -fprint-expanded-synonyms
Ömer Sinan Ağacan [Thu, 16 Jul 2015 22:02:09 +0000 (00:02 +0200)] 
Implement -fprint-expanded-synonyms

Add a flag to print type-synonyms-expanded versions of types in type
error messages (in addition to old error messages with synonyms)

 * Mailing list discussion:
 * Wiki page:
 * Trac:

Test Plan:
 * I'll find some examples and add tests.

Reviewers: austin, simonpj, goldfire, bgamari

Reviewed By: austin, simonpj, goldfire, bgamari

Subscribers: rodlogic, thomie, bgamari

Differential Revision:

GHC Trac Issues: #10547

4 years agoFix tests
Ben Gamari [Fri, 10 Jul 2015 11:48:24 +0000 (13:48 +0200)] 
Fix tests

4 years agoCoreLint: Use size-annotated ppr variant
Ben Gamari [Mon, 22 Jun 2015 10:48:07 +0000 (12:48 +0200)] 
CoreLint: Use size-annotated ppr variant

4 years agoPprCore: Add size annotations for top-level bindings
Ben Gamari [Mon, 22 Jun 2015 10:47:33 +0000 (12:47 +0200)] 
PprCore: Add size annotations for top-level bindings

4 years agoCoreUtils: Move size utilities to CoreStats
Ben Gamari [Mon, 22 Jun 2015 10:35:02 +0000 (12:35 +0200)] 
CoreUtils: Move size utilities to CoreStats

This allows PprCore to use these functions. It will soon do so to enable
CoreLint to output size annotations on top-level bindings.

4 years agoCoreUtils: Move seq* functions to CoreSeq
Ben Gamari [Tue, 7 Jul 2015 18:25:50 +0000 (20:25 +0200)] 
CoreUtils: Move seq* functions to CoreSeq

These seem to sit near the top of the import graph and have been causing
import cycles.

4 years agoFailing test case: idArity invariant check, #10181
Joachim Breitner [Thu, 16 Jul 2015 13:57:42 +0000 (15:57 +0200)] 
Failing test case: idArity invariant check, #10181

This was found Thomas Miedema.

4 years agoDocs: `sortOn = sortBy (comparing f)` [skip ci]
Thomas Miedema [Thu, 16 Jul 2015 08:10:18 +0000 (10:10 +0200)] 
Docs: `sortOn = sortBy (comparing f)` [skip ci]

4 years agoinitGroup: only initialize the first and last blocks of a group
Simon Marlow [Wed, 15 Jul 2015 11:57:18 +0000 (12:57 +0100)] 
initGroup: only initialize the first and last blocks of a group

Summary: Initialising the whole group is expensive and unnecessary.

Test Plan: validate

Reviewers: austin, bgamari, rwbarton

Subscribers: thomie

Differential Revision:

4 years agoFix #10642.
Richard Eisenberg [Wed, 15 Jul 2015 13:50:57 +0000 (09:50 -0400)] 
Fix #10642.

Representational equalities cannot discharge nominal ones.
Even if, somehow, this didn't cause a type error (as reported
in the ticket), it would surely cause a core lint error.

4 years agoDon't get a new nursery if we exceeded large_alloc_lim
Simon Marlow [Wed, 15 Jul 2015 12:07:35 +0000 (13:07 +0100)] 
Don't get a new nursery if we exceeded large_alloc_lim

When using nursery chunks, if we failed a heap check due to
large_alloc_lim, we would pointlessly keep grabbing new nursery
chunks when we should just GC immediately.

Test Plan: validate

Reviewers: austin, bgamari, niteria

Subscribers: thomie

Differential Revision:

4 years agoRemove all references to sync-all
Thomas Miedema [Tue, 14 Jul 2015 15:15:12 +0000 (17:15 +0200)] 
Remove all references to sync-all

4 years agoBuild system: delete [skip ci]
Thomas Miedema [Wed, 15 Jul 2015 08:18:37 +0000 (10:18 +0200)] 
Build system: delete [skip ci]

fingerprint makes no sense anymore w/ submodules.

4 years agoTestsuite: mark T10294 conditionally expect_broken on #10301
Thomas Miedema [Wed, 15 Jul 2015 11:27:59 +0000 (13:27 +0200)] 
Testsuite: mark T10294 conditionally expect_broken on #10301

Fix 8e6a50339a4a61d4f2cbec645c78abc85098a294.

4 years agoMark test case for #10294 conditionally expect_broken on #10301
Joachim Breitner [Wed, 15 Jul 2015 08:41:03 +0000 (10:41 +0200)] 
Mark test case for #10294 conditionally expect_broken on #10301

the hypothesis is that it only breaks with `DYNAMIC_GHC_PROGRAMS = NO`,
so use `unless(have_dynamic(),expect_broken(10301))` to not break the
Phabricator build.

4 years agoFlush stdout in test case for #10596
Joachim Breitner [Wed, 15 Jul 2015 08:29:26 +0000 (10:29 +0200)] 
Flush stdout in test case for #10596

which might help, as it has helped with lots of other TH-related test
cases in the past.

4 years agoMark test case for #10294 expect_broken on #10301
Joachim Breitner [Wed, 15 Jul 2015 08:26:05 +0000 (10:26 +0200)] 
Mark test case for #10294 expect_broken on #10301

as it is broken on Travis, and in #10301 others have reported the same

4 years agoTestsuite: delete *.stderr-ghc-7.0 *.stdout-ghc-7.0
Thomas Miedema [Tue, 14 Jul 2015 11:57:29 +0000 (13:57 +0200)] 
Testsuite: delete *.stderr-ghc-7.0 *.stdout-ghc-7.0

No point in pretending the testsuite can be run with older versions of GHC.

4 years agoTestsuite: rename *.stderr-ghc to *.stderr
Thomas Miedema [Tue, 14 Jul 2015 11:37:55 +0000 (13:37 +0200)] 
Testsuite: rename *.stderr-ghc to *.stderr

And *.stdout-ghc to *.stdout. We only have output files for ghc now.

4 years agotraivs: Use the new container based travis setup
Joachim Breitner [Tue, 14 Jul 2015 07:54:28 +0000 (09:54 +0200)] 
traivs: Use the new container based travis setup

which supposedly has more resources, so maybe this makes travis useful
for us again.

4 years agoTestsuite: delete remaining only_compiler_types(['ghc']) setups
Thomas Miedema [Mon, 13 Jul 2015 10:18:10 +0000 (12:18 +0200)] 
Testsuite: delete remaining only_compiler_types(['ghc']) setups

No point in pretending other compilers can use the GHC testsuite. This
makes the *.T files a bit shorter.

4 years agoTestsuite: delete unused with_namebase
Thomas Miedema [Mon, 13 Jul 2015 09:30:37 +0000 (11:30 +0200)] 
Testsuite: delete unused with_namebase

It was introduced in 39c6c735c216d259854ee31b15ec87ea653f2b5d (2007).

4 years agoBuild system: do not build stm and parallel by default
Thomas Miedema [Fri, 10 Jul 2015 17:15:49 +0000 (19:15 +0200)] 
Build system: do not build stm and parallel by default

stm and parallel have an 'extra' tag in the ./packages file, so would get
added to PACKAGES_STAGE2 by default, and subsequently build by the stage2

With this patch, this happens only when you set BUILD_EXTRA_PKGS=YES in A normal validate still builds (and tests) the 'extra'
packages, but they are skipped for `validate --fast`. Maybe this brings
us closer to finishing within the 50 minute Travis limit as well.

We can later try to give random, primitive and vector an 'extra' tag as
well (now they have a 'dph' tag), but some tests will probably fail at

Differential Revision:

4 years agoBuild system: delete REGULAR_INSTALL_DYNLIBS and INSTALL_DYNLIBS
Thomas Miedema [Thu, 9 Jul 2015 17:21:28 +0000 (19:21 +0200)] 

Ever since we ship xhtml, terminfo and haskeline (#8919), commit
4caadb7cbee5c176abb99df25c4cc1657ae57f40, REGULAR_INSTALL_DYNLIBS is
always empty.



So we can delete it, and all the places where it is used. This
simplifies a bit.

Differential Revision:

4 years agoBuild system: delete two unused files
Thomas Miedema [Mon, 13 Jul 2015 09:34:17 +0000 (11:34 +0200)] 
Build system: delete two unused files

They were introduced in 6ae696a1d1f25bf52923a3dd1c3b4a08e2033bfd. We do
cross-compilation differently now.

4 years agoBuild system: add `make show!` command (#7810)
Thomas Miedema [Fri, 10 Jul 2015 16:38:02 +0000 (18:38 +0200)] 
Build system: add `make show!` command (#7810)

A normal `make show` starts a build of the ghc-stage1 compiler, to
create files. This version doesn't read those, so it
will work right after ./configure.

Differential Revision:

4 years agoBuild system: comments only [skip ci]
Thomas Miedema [Thu, 9 Jul 2015 17:27:17 +0000 (19:27 +0200)] 
Build system: comments only [skip ci]

4 years agoAnother comment with a leading # (sigh)
Simon Peyton Jones [Mon, 13 Jul 2015 12:30:47 +0000 (13:30 +0100)] 
Another comment with a leading # (sigh)

4 years agoTest Trac #10634
Simon Peyton Jones [Mon, 13 Jul 2015 12:28:27 +0000 (13:28 +0100)] 
Test Trac #10634

4 years agoTest Trac #10463
Simon Peyton Jones [Mon, 13 Jul 2015 12:20:56 +0000 (13:20 +0100)] 
Test Trac #10463

was fixed along with Trac #10224

4 years agoReformat a leading # in a comment
Simon Peyton Jones [Mon, 13 Jul 2015 12:08:44 +0000 (13:08 +0100)] 
Reformat a leading # in a comment

The leading hash in a comment confused CPP, though
it worked fine on my machine. Apologies.

4 years agoMake sure rule LHSs are simplified
Simon Peyton Jones [Mon, 13 Jul 2015 11:58:34 +0000 (12:58 +0100)] 
Make sure rule LHSs are simplified

SpecConstr was generating a rule LHS with nested casts,
which the simplifier then optimised away.  Result: unbound
template variables.

Easily fixed.  See Note [SpecConstr call patterns]

4 years agoAdd Linting for Rules
Simon Peyton Jones [Mon, 13 Jul 2015 09:40:44 +0000 (10:40 +0100)] 
Add Linting for Rules

4 years agoDo not optimise RULE lhs in substRule
Simon Peyton Jones [Mon, 13 Jul 2015 09:29:18 +0000 (10:29 +0100)] 
Do not optimise RULE lhs in substRule

This was causing Trac #10627.
See Note [Substitute lazily] in CoreSubst.

The bug was introduced by
   commit 30c17e7096919c55218083c8fcb98e6287552058
    Author: <unknown>
    Date:   Thu Nov 25 17:23:56 2010 +0000
    Substitution should just substitute, not optimise

The fix is not to optimise the RHS as well as not-optimising the LHS!
The simplifier does the right thing in Simplify.simplRule

4 years agoT9872d: Update 32-bit allocations
Ben Gamari [Sat, 11 Jul 2015 11:07:34 +0000 (13:07 +0200)] 
T9872d: Update 32-bit allocations

4 years agoperf/compiler: Switch to -G1 and update performance metrics
Ben Gamari [Sat, 11 Jul 2015 10:53:40 +0000 (10:53 +0000)] 
perf/compiler: Switch to -G1 and update performance metrics

4 years agoT876 (32-bit): Update bytes allocated
Ben Gamari [Sat, 11 Jul 2015 10:42:14 +0000 (12:42 +0200)] 
T876 (32-bit): Update bytes allocated

This seems to have improved by a bit

4 years agoT1969: Update max_bytes_used
Ben Gamari [Sat, 11 Jul 2015 10:27:20 +0000 (12:27 +0200)] 
T1969: Update max_bytes_used

b5e1944e2b069a7df3444e57bae0b4ee15bde73c started using a single GC
generation yet didn't update this.

4 years agoFix self-contained handling of ASCII encoding
Ben Gamari [Fri, 10 Jul 2015 17:49:29 +0000 (19:49 +0200)] 
Fix self-contained handling of ASCII encoding

D898 was primarily intended to fix hangs in the event that iconv was
unavailable (namely #10298 and #7695). In addition to this fix, it also
introduced self-contained handling of ANSI terminals to allow compiled
executables to run in minimal environments lacking iconv.

However, the behavior that the patch introduced is highly suspicious.
Specifically, it gives the user a UTF-8 encoding even if they requested

This has the potential to break quite a lot of code. At very least it
breaks GHC's Unicode terminal detection logic, which attempts to catch
an invalid character when encoding a pair of smart-quotes. Of course,
this exception will never be thrown if a UTF-8 encoder is used.

Here we use the `char8` encoding to handle requests for ASCII encodings
in the event that we find iconv to be non-functional.

Fixes #10623.

Test Plan: Validate with T8959a

Reviewers: rwbarton, hvr, austin, hsyl20

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10623

4 years agoDelete the WayPar way
Thomas Miedema [Wed, 8 Jul 2015 19:09:33 +0000 (21:09 +0200)] 
Delete the WayPar way

Also remove 't' and 's' from ALL_WAYS; they don't exist.

Differential Revision:

4 years agoImprove error message for fundeps
Simon Peyton Jones [Fri, 10 Jul 2015 15:24:46 +0000 (16:24 +0100)] 
Improve error message for fundeps

Improve error message fundeps, especially when PolyKinds means that
the un-determined variables are (invisible) kind variables.

See Trac #10570.

4 years agoUpdate .mailmap [skip ci]
Thomas Miedema [Fri, 10 Jul 2015 15:05:08 +0000 (17:05 +0200)] 
Update .mailmap [skip ci]

4 years agoBetter type wildcard errors
Simon Peyton Jones [Fri, 10 Jul 2015 11:53:53 +0000 (12:53 +0100)] 
Better type wildcard errors

Adopts sugggestion in Trac #10224, comment:3

4 years agoComments only
Simon Peyton Jones [Fri, 10 Jul 2015 11:52:50 +0000 (12:52 +0100)] 
Comments only

4 years agoMake mkQualPackage more robust when package key is bad.
Edward Z. Yang [Thu, 9 Jul 2015 17:21:51 +0000 (10:21 -0700)] 
Make mkQualPackage more robust when package key is bad.

Signed-off-by: Edward Z. Yang <>
Test Plan: validate

Reviewers: bgamari, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10624

4 years agoAdd testcase for #10602
Ben Gamari [Thu, 9 Jul 2015 09:12:05 +0000 (05:12 -0400)] 
Add testcase for #10602

4 years agousers_guide: Fix errant "a" in RULES/class methods docs
Ben Gamari [Thu, 9 Jul 2015 12:08:20 +0000 (14:08 +0200)] 
users_guide: Fix errant "a" in RULES/class methods docs

4 years agoInfer types with flexible contexts
Simon Peyton Jones [Thu, 9 Jul 2015 12:03:34 +0000 (13:03 +0100)] 
Infer types with flexible contexts

Responding to Trac #10608 and Trac #10351, I've reverted
to making type inference infer structured constraint like
    f :: C [t] => t -> t
even if -XFlexibleContexts is not set.  That elicits an
error message suggesting the flag.  The result is more
helpful than the error message you get otherwise.

4 years agoWhite space only
Simon Peyton Jones [Thu, 9 Jul 2015 12:00:59 +0000 (13:00 +0100)] 
White space only

4 years agoDocument RULES and class methods
Simon Peyton Jones [Thu, 9 Jul 2015 11:46:58 +0000 (12:46 +0100)] 
Document RULES and class methods

Relates to Trac #10595

4 years agoBitmap: Fix thunk explosion
Ben Gamari [Thu, 9 Jul 2015 00:08:01 +0000 (02:08 +0200)] 
Bitmap: Fix thunk explosion

Previously we would build up another `map (-N)` thunk
for every word in the bitmap. Now we strictly accumulate the position
and carry out a single ``map (`subtract` accum)``.

`Bitmap.intsToBitmap` showed up in the profile while compiling a
testcase of #7450 (namely a program containing a record type with large
number of fields which derived `Read`). The culprit was
`CmmBuildInfoTables.procpointSRT.bitmap`. On the testcase (with 4096
fields), the profile previously looked like,

total time  =      307.94 secs   (307943 ticks @ 1000 us, 1
total alloc = 336,797,868,056 bytes  (excludes profiling

COST CENTRE              MODULE              %time %alloc

lintAnnots               CoreLint             17.2   25.8
procpointSRT.bitmap      CmmBuildInfoTables   11.3   25.2
FloatOutwards            SimplCore             7.5    1.6
flatten.lookup           CmmBuildInfoTables    4.0    3.9

After this fix it looks like,
total time  =      256.88 secs   (256876 ticks @ 1000 us, 1
total alloc = 255,033,667,448 bytes  (excludes profiling

COST CENTRE              MODULE              %time %alloc

lintAnnots               CoreLint             20.3   34.1
FloatOutwards            SimplCore             9.1    2.1
flatten.lookup           CmmBuildInfoTables    4.8    5.2
pprNativeCode            AsmCodeGen            3.7    4.3
simplLetUnfolding        Simplify              3.6    2.2
StgCmm                   HscMain               3.6    2.1

Signed-off-by: Ben Gamari <>
Test Plan: Validate

Reviewers: austin, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #7450

4 years agoFix Trac #10618 (out of scope operator)
Simon Peyton Jones [Wed, 8 Jul 2015 22:42:28 +0000 (23:42 +0100)] 
Fix Trac #10618 (out of scope operator)

Out of scope variables now generate HsUnboundVar,
and the fixity re-jigging wasn't taking this into

4 years agoComments only
Simon Peyton Jones [Wed, 8 Jul 2015 22:19:42 +0000 (23:19 +0100)] 
Comments only

4 years agoBroaden Outputable instance for Termination
Simon Peyton Jones [Thu, 2 Jul 2015 21:56:14 +0000 (22:56 +0100)] 
Broaden Outputable instance for Termination

4 years agoDelete duplicate "Note [Unpack equality predicates]"
Thomas Miedema [Wed, 8 Jul 2015 14:31:02 +0000 (16:31 +0200)] 
Delete duplicate "Note [Unpack equality predicates]"

The other one is MkId.hs.

4 years agoUnbreak Windows build: delete unusud throwIOIO
Thomas Miedema [Wed, 8 Jul 2015 13:30:30 +0000 (15:30 +0200)] 
Unbreak Windows build: delete unusud throwIOIO

Should have been part of 9aa0e4b23d074af44363236fb0f120f07c6e0067.

4 years agoholePackageKey and isHoleModule utility functions.
Edward Z. Yang [Tue, 23 Jun 2015 20:31:15 +0000 (13:31 -0700)] 
holePackageKey and isHoleModule utility functions.

Signed-off-by: Edward Z. Yang <>
4 years agoBackpack: Flesh out more Cabal details
Edward Z. Yang [Wed, 8 Jul 2015 02:49:32 +0000 (19:49 -0700)] 
Backpack: Flesh out more Cabal details

Signed-off-by: Edward Z. Yang <>
4 years agoExport more types from GHC.RTS.Flags (#9970)
RyanGlScott [Tue, 7 Jul 2015 19:20:07 +0000 (21:20 +0200)] 
Export more types from GHC.RTS.Flags (#9970)

Export the data types `GiveGCStats`, `DoCostCentres`, `DoHeapProfiles`,
and `DoTrace`, as well as the type synonyms `Time` and `RtsNat`. The
above data types appear as fields in the `-Stats` data types in
`GHC.RTS.Flags`, but since they only have `Show` instances, it is
practically impossible to due anything useful with the above types
unless they are exported.

Reviewers: hvr, ekmett, austin, ezyang, bgamari

Reviewed By: bgamari

Subscribers: thomie, bgamari

Differential Revision:

GHC Trac Issues: #9970

4 years agoFix #10596 by looking up 'Int' not 'Maybe Int' in the map.
Edward Z. Yang [Tue, 7 Jul 2015 19:19:54 +0000 (21:19 +0200)] 
Fix #10596 by looking up 'Int' not 'Maybe Int' in the map.

Test Plan: validate

Reviewers: goldfire, austin, simonpj, bgamari

Reviewed By: bgamari

Subscribers: simonpj, rwbarton, thomie, bgamari

Differential Revision:

GHC Trac Issues: #10596

4 years agoalways use -fPIC on OpenBSD/AMD64 platform
Karel Gardas [Tue, 7 Jul 2015 16:35:09 +0000 (18:35 +0200)] 
always use -fPIC on OpenBSD/AMD64 platform

This patch switches -fPIC on for every invocation of GHC
on OpenBSD/AMD64 platform. The reason is OpenBSD's support
for PIE (PIC for executables) hence -fPIC is also needed
for GHC compiled code.

Fixes #10597

Reviewers: austin

Subscribers: thomie, bgamari

Differential Revision:

4 years agoGeneralize `Control.Monad.forever`
Ben Gamari [Tue, 7 Jul 2015 15:07:06 +0000 (17:07 +0200)] 
Generalize `Control.Monad.forever`

This generalizes forever to depend on Applicative, rather than Monad.

This was proposed a month ago

Differential Revision:

4 years agofix EBADF unqueueing in select backend (Trac #10590)
Sergei Trofimovich [Tue, 7 Jul 2015 15:00:23 +0000 (17:00 +0200)] 
fix EBADF unqueueing in select backend (Trac #10590)

Alexander found a interesting case:
1. We have a queue of two waiters in a blocked_queue
2. first file descriptor changes state to RUNNABLE,
   second changes to INVALID
3. awaitEvent function dequeued RUNNABLE thread to a
   run queue and attempted to dequeue INVALID descriptor
   to a run queue.

Unqueueing INVALID fails thusly:
        #3  0x000000000045cf1c in barf (s=0x4c1cb0 "removeThreadFromDeQueue: not found")
                               at rts/RtsMessages.c:42
        #4  0x000000000046848b in removeThreadFromDeQueue (...) at rts/Threads.c:249
        #5  0x000000000049a120 in removeFromQueues (...) at rts/RaiseAsync.c:719
        #6  0x0000000000499502 in throwToSingleThreaded__ (...) at rts/RaiseAsync.c:67
        #7  0x0000000000499555 in throwToSingleThreaded (..) at rts/RaiseAsync.c:75
        #8  0x000000000047c27d in awaitEvent (wait=rtsFalse) at rts/posix/Select.c:415

The problem here is a throwToSingleThreaded function that tries
to unqueue a TSO from blocked_queue, but awaitEvent function
leaves blocked_queue in a inconsistent state while traverses
over blocked_queue:

      case RTS_FD_IS_READY:
              debugBelch("Waking up blocked thread %lu\n",
                         (unsigned long)tso->id));
          tso->why_blocked = NotBlocked;
          tso->_link = END_TSO_QUEUE;              // Here we break the queue head

Signed-off-by: Sergei Trofimovich <>
Test Plan: tested on a sample from T10590

Reviewers: austin, bgamari, simonmar

Reviewed By: bgamari, simonmar

Subscribers: qnikst, thomie, bgamari

Differential Revision:

GHC Trac Issues: #10590, #4934

4 years agoDeferred type errors now throw TypeError (#10284)
David Kraeutmann [Tue, 7 Jul 2015 14:59:52 +0000 (16:59 +0200)] 
Deferred type errors now throw TypeError (#10284)

Depends on D864.

Previous behaviour was ErrorCall, which might mask issues in tests
using -fdefer-type-errors

Signed-off-by: David Kraeutmann <>
Test Plan: Test whether the error thrown is indeed TypeError and not

Reviewers: hvr, nomeata, austin

Reviewed By: nomeata, austin

Subscribers: nomeata, simonpj, thomie

Differential Revision:

GHC Trac Issues: #10284

4 years agoFix todo in compiler/nativeGen: Rename Size to Format
markus [Tue, 7 Jul 2015 14:59:40 +0000 (16:59 +0200)] 
Fix todo in compiler/nativeGen: Rename Size to Format

This commit renames the Size module in the native code generator to
Format, as proposed by a todo, as well as adjusting parameter names in
other modules that use it.

Test Plan: validate

Reviewers: austin, simonmar, bgamari

Reviewed By: simonmar, bgamari

Subscribers: bgamari, simonmar, thomie

Projects: #ghc

Differential Revision:

4 years agoAllow deferred type error warnings to be suppressed
David Kraeutmann [Tue, 7 Jul 2015 14:59:34 +0000 (16:59 +0200)] 
Allow deferred type error warnings to be suppressed

Adds a flag -fwarn-deferred-type-errors similar to -fwarn-typed-holes.
Changes the boolean flag of -fdefer-type-errors to a 3-state flag
similar to the one used by -fdefer-typed-holes/-fwarn-typed-holes.

Test Plan: Since only the absence of deferred type error warnings when
-fno-warn-deferred-type-errors is passed has to be tested, I duplicated
a test case checking -fdefer-type-errors and adjusted it accordingly.

Reviewers: nomeata, simonpj, austin, thomie, bgamari, hvr

Reviewed By: nomeata, simonpj, austin, thomie, bgamari, hvr

Subscribers: bgamari, simonpj, nomeata, thomie

Projects: #ghc

Differential Revision:

GHC Trac Issues: #10283

4 years agoUpdate comments around blackholes
Simon Marlow [Tue, 7 Jul 2015 07:52:53 +0000 (08:52 +0100)] 
Update comments around blackholes

Test Plan: validate

Reviewers: austin, bgamari

Subscribers: thomie

Differential Revision:

4 years agoFix word repetitions in comments
Gabor Greif [Tue, 7 Jul 2015 13:52:57 +0000 (15:52 +0200)] 
Fix word repetitions in comments

4 years agoBuild system: don't set GhcLibWays explicitly in (#10536)
Thomas Miedema [Mon, 29 Jun 2015 20:42:42 +0000 (22:42 +0200)] 
Build system: don't set GhcLibWays explicitly in (#10536)

We used to have the following in mk/

  GhcLibWays = $(if $(filter $(DYNAMIC_GHC_PROGRAMS),YES),v dyn,v)

This commit removes that statement for the following reasons:

  1) It depends on the variable DYNAMIC_GHC_PROGRAMS, which is set later
     in the file for some BuildFlavours. Although this works because
     `make` does multiple passes when reading Makefiles, it is confusing
     to users [1]. Instead, test for DYNAMIC_GHC_PROGRAMS in

  2) Although it looks like that line is about compiling the `dyn` way,
     its purpose is really to not build the `prof` way. This commit
     introduces the variable BUILD_PROF_LIBS, to make this more

This simplifies mk/ and mk/

Note that setting GhcLibWays explicitly still works, and
DYNAMIC_GHC_PROGRAMS=NO in does not build the `dyn` way.


Differential Revision:

4 years agoAdd Note [Warnings in code generated by Alex]
Thomas Miedema [Mon, 6 Jul 2015 18:28:04 +0000 (20:28 +0200)] 
Add Note [Warnings in code generated by Alex]

Differential Revision:

4 years agoFix "CPP directive" in comment
Ben Gamari [Tue, 7 Jul 2015 09:50:48 +0000 (11:50 +0200)] 
Fix "CPP directive" in comment

4 years agoAdd more discussion of black-holing logic for #10414
Ben Gamari [Mon, 6 Jul 2015 17:29:21 +0000 (19:29 +0200)] 
Add more discussion of black-holing logic for #10414

Signed-off-by: Ben Gamari <>
4 years agoDon't eagerly blackhole single-entry thunks (#10414)
Reid Barton [Mon, 6 Jul 2015 17:24:31 +0000 (19:24 +0200)] 
Don't eagerly blackhole single-entry thunks (#10414)

In a parallel program they can actually be entered more than once,
leading to deadlock.

Reviewers: austin, simonmar

Subscribers: michaelt, thomie, bgamari

Differential Revision:

GHC Trac Issues: #10414

4 years agoFix offset calculation in __stg_gc_fun
Simon Marlow [Mon, 6 Jul 2015 13:09:50 +0000 (14:09 +0100)] 
Fix offset calculation in __stg_gc_fun

We were not treating the offset as a signed field in this rare case,
so it would blow up if the offset was negative.

Test Plan: Looked at the assembly

Reviewers: austin, bgamari, rwbarton

Subscribers: thomie

Differential Revision:

4 years agoSpelling in comments
Gabor Greif [Tue, 23 Jun 2015 14:35:20 +0000 (16:35 +0200)] 
Spelling in comments

4 years agoRemove warnings for -fwarn-incomplete-patterns
Alan Zimmerman [Mon, 6 Jul 2015 09:13:05 +0000 (11:13 +0200)] 
Remove warnings for -fwarn-incomplete-patterns

And remove one unused bind.

for concerns raised prompting this change.

4 years agoSpecialise: Avoid unnecessary recomputation of free variable information
Ben Gamari [Mon, 6 Jul 2015 08:46:21 +0000 (10:46 +0200)] 
Specialise: Avoid unnecessary recomputation of free variable information

When examining compile times for code with large ADTs (particularly those with
many record constructors), I found that the specialiser contributed
disproportionately to the compiler runtime. Some profiling suggested that
the a great deal of time was being spent in `pair_fvs` being called from

@simonpj pointed out that `flattenDictBinds` as called by `specBind` was
unnecessarily discarding cached free variable information, which then needed to
be recomputed by `pair_fvs`.

Here I refactor the specializer to retain the free variable cache whenever

**Open Qustions**

 * I used `fst` in a couple of places to extract the bindings from a `DictBind`.
   Perhaps this is a sign that `DictBind` has outgrown its type synonym status?

Test Plan: validate

Reviewers: austin, simonpj

Reviewed By: simonpj

Subscribers: thomie, bgamari, simonpj

Differential Revision:

GHC Trac Issues: #7450

4 years agoRemove all *.stderr/stdout-hugs files
Thomas Miedema [Sat, 4 Jul 2015 14:13:11 +0000 (16:13 +0200)] 
Remove all *.stderr/stdout-hugs files

4 years agoRemove Hugs specific test setups (omit_compiler_type)
Thomas Miedema [Sat, 4 Jul 2015 14:11:17 +0000 (16:11 +0200)] 
Remove Hugs specific test setups (omit_compiler_type)

4 years agorts: fix incorrect checking start for -x arguments (#9839)
Nikita Kartashov [Sun, 5 Jul 2015 23:09:26 +0000 (01:09 +0200)] 
rts: fix incorrect checking start for -x arguments (#9839)

After previous fix, flag combinations such as -xt and -xc
resulted in an error due to the fact that the checking started from
index 2, which was always 'x' in that case.
Now they are correctly processed.

Differential Revision:

4 years agoFix typo [skip ci] (#10605)
Thomas Miedema [Sun, 5 Jul 2015 10:37:33 +0000 (12:37 +0200)] 
Fix typo [skip ci] (#10605)

4 years agoEasy way to defer type errors (implements #8353)
Benjamin Bykowski [Sat, 4 Jul 2015 23:38:22 +0000 (01:38 +0200)] 
Easy way to defer type errors (implements #8353)

Added load! and reload! commands, effectively setting
"-fdefer-type-errors" before loading a file and
unsetting it after loading if it has not been set before.

Differential Revision:

4 years agoLexer.x and Parser.y: delete dead code
Thomas Miedema [Sat, 4 Jul 2015 21:06:06 +0000 (23:06 +0200)] 
Lexer.x and Parser.y: delete dead code

4 years agoUse -fno-warn-unused-imports instead of hiding `ord`
Thomas Miedema [Sat, 4 Jul 2015 16:20:06 +0000 (18:20 +0200)] 
Use -fno-warn-unused-imports instead of hiding `ord`

This is more future proof. Maybe later versions of Alex won't `import
Data.Char (ord)` anymore.

4 years agoComments only [skip ci]
Thomas Miedema [Sat, 4 Jul 2015 09:57:44 +0000 (11:57 +0200)] 
Comments only [skip ci]

Follow up to 124f3999d78d8ef6b093e4f1bb1dcef87e4283da.

4 years agoLexer: remove -fno-warn-unused-do-bind
Thomas Miedema [Sat, 4 Jul 2015 13:20:04 +0000 (15:20 +0200)] 
Lexer: remove -fno-warn-unused-do-bind

4 years agoRemove dead code / overlapping pattern (#9723)
Thomas Miedema [Sat, 4 Jul 2015 13:27:45 +0000 (15:27 +0200)] 
Remove dead code / overlapping pattern (#9723)

4 years agoTestsuite: add -ignore-dot-ghci to some tests
Thomas Miedema [Sat, 4 Jul 2015 09:57:44 +0000 (11:57 +0200)] 
Testsuite: add -ignore-dot-ghci to some tests

Since T10408A and T10408B would become the same now, delete T10408A and
rename T10408B to T10408. The test without -ignore-dot-ghci (T10408A)
didn't add anything (#10408).

4 years agoSupport MO_{Add,Sub}IntC and MO_Add2 in the LLVM backend
Michal Terepeta [Sat, 4 Jul 2015 10:52:02 +0000 (12:52 +0200)] 
Support MO_{Add,Sub}IntC and MO_Add2 in the LLVM backend

This includes:

- Adding new LlvmType called LMStructP that represents an unpacked
  struct (this is necessary since LLVM's instructions the
  llvm.sadd.with.overflow.* return an unpacked struct).

- Modifications to LlvmCodeGen.CodeGen to generate the LLVM
  instructions for the primops.

- Modifications to StgCmmPrim to actually use those three instructions
  if we use the LLVM backend (so far they were only used for NCG).

Test Plan: validate

Reviewers: austin, rwbarton, bgamari

Reviewed By: bgamari

Subscribers: thomie, bgamari

Differential Revision:

GHC Trac Issues: #9430

4 years agoReplace usages of `-w` by `-fno-warn`s
Thomas Miedema [Thu, 2 Jul 2015 23:19:59 +0000 (01:19 +0200)] 
Replace usages of `-w` by `-fno-warn`s

And remove unused imports and language pragmas.

I checked that the minimum Happy and Alex version requirements, as
listed in aclocal.m4, don't have to change. Before building ghc, I ran:
  - cabal install happy==1.19.4 --with-ghc=ghc-7.8.4
  - cabal install alex==3.1.0 --with-ghc=ghc-7.6.3

Differential Revision:

4 years agoFix some validation errors.
Richard Eisenberg [Sat, 4 Jul 2015 07:38:59 +0000 (09:38 +0200)] 
Fix some validation errors.

This fixes test cases T10019 and T10534

The patch for T10019 should be back-ported to master as well.

Posting via Phab as a way to distribute a patch against the
ghc-7.10 branch, which I don't have push access to.

Test Plan: validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, bgamari, mzero

Differential Revision:

4 years agoparser: Allow Lm (MODIFIER LETTER) category in identifiers
Thomas Miedema [Fri, 3 Jul 2015 20:37:18 +0000 (22:37 +0200)] 
parser: Allow Lm (MODIFIER LETTER) category in identifiers

Easy fix in the parser to stop regressions, due to Unicode 7.0 changing
the classification of some prior code points.

Signed-off-by: Austin Seipp <>
Test Plan: `tests/parser/should_compile/T10196.hs`

Reviewers: hvr, austin, bgamari

Reviewed By: austin, bgamari

Subscribers: thomie, bgamari

Differential Revision:

GHC Trac Issues: #10196

4 years agoGeneralize traceM, traceShowM (fixes #10023)
RyanGlScott [Fri, 3 Jul 2015 17:37:06 +0000 (19:37 +0200)] 
Generalize traceM, traceShowM (fixes #10023)

This generalizes the type signatures of `traceM` and `traceShowM` to
use `Applicative` rather than `Monad`.

Reviewers: austin, ekmett, hvr, bgamari

Reviewed By: ekmett, hvr, bgamari

Subscribers: thomie, bgamari

Differential Revision:

GHC Trac Issues: #10023

4 years agoAdd "since" column for LANGUAGE extensions in user guide
Alexey Shmalko [Fri, 3 Jul 2015 17:36:56 +0000 (19:36 +0200)] 
Add "since" column for LANGUAGE extensions in user guide

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, bgamari

Differential Revision:

GHC Trac Issues: #9665

4 years agoRemove redundant parser entry point
Matthew Pickering [Fri, 3 Jul 2015 17:36:48 +0000 (19:36 +0200)] 
Remove redundant parser entry point

`parseFullStmt` and `parseStatement` exposed the same parser entry

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: gibiansky, alanz, thomie, bgamari

Differential Revision:

4 years agousers_guide: Describe order-dependence of -f and -O flags
Ben Gamari [Fri, 3 Jul 2015 17:36:12 +0000 (19:36 +0200)] 
users_guide: Describe order-dependence of -f and -O flags

The behavior of the -f and -O options can be quite surprising.
Document this fact. At some point this behavior should likely be changed.

Test Plan: documentation only

Reviewers: austin, trofi

Reviewed By: austin, trofi

Subscribers: thomie, bgamari

Differential Revision:

GHC Trac Issues: #10560

4 years agoRemove unnecessary OrdList from decl parser.
Matthew Pickering [Fri, 3 Jul 2015 17:35:45 +0000 (19:35 +0200)] 
Remove unnecessary OrdList from decl parser.

Each production produced a singleton list.

Similar treatment is applied to the decl_cls parser.

This changes the type of the parseDeclaration entry point to

`parseDeclaration :: P (LHsDecl RdrName)`


`parseTypeSignature :: P (LHsDecl RdrName)`

which is in line with the other parser entry points.

This patch also updates the conflict commentary.  There were 4 reduce/reduce
conflicts introduced by `ffc21506894c7887d3620423aaf86bc6113a1071` which
refactored tuple constraints.

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, bgamari

Differential Revision:

4 years agoFix Trac #10519
Thomas Winant [Fri, 3 Jul 2015 17:35:29 +0000 (19:35 +0200)] 
Fix Trac #10519

Look through nested foralls when checking the validity of a partial type
signature. The combination of D836 and D613 prompts this change.

Test Plan: The test T10519 must pass

Reviewers: simonpj, alanz, austin

Reviewed By: simonpj, alanz, austin

Subscribers: thomie, bgamari

Differential Revision:

GHC Trac Issues: #10519

4 years agoEnable using qualified field of constructor in GHCi
Zejun Wu [Fri, 3 Jul 2015 17:31:25 +0000 (19:31 +0200)] 
Enable using qualified field of constructor in GHCi

The -fimplicit-import-qualified made it possible to uses qualifed names
in GHCi without explicitly import the modules. But it didn't work for
field of constructor, this patch fixed this issue.

Test Plan:
cd testsuite/tests/rename/ && make
cd testsuite/tests/ghci/ && make

Reviewers: austin, simonpj

Reviewed By: austin, simonpj

Subscribers: bgamari, thomie

Differential Revision:

GHC Trac Issues: #10439