3 years agoMake DeriveFunctor work with unboxed tuples
Ryan Scott [Mon, 18 Jul 2016 13:28:42 +0000 (09:28 -0400)] 
Make DeriveFunctor work with unboxed tuples

Unboxed tuples have `RuntimeRep` arguments which `-XDeriveFunctor` was
mistaking for actual data constructor arguments. As a result, a derived
`Functor` instance for a datatype that contained an unboxed tuple would
generate twice as many arguments as it needed for an unboxed tuple pattern
match or expression. The solution is to simply put `dropRuntimeRepArgs` in the
right place.

Fixes #12399.

Test Plan: ./validate

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: thomie, osa1

Differential Revision:

GHC Trac Issues: #12399

3 years agoFix misspellings of the word "instance" in comments
Ryan Scott [Mon, 18 Jul 2016 13:14:36 +0000 (09:14 -0400)] 
Fix misspellings of the word "instance" in comments

[ci skip]

3 years agohp2ps: fix invalid PostScript for names with parentheses
Ben Gamari [Sat, 16 Jul 2016 22:14:04 +0000 (00:14 +0200)] 
hp2ps: fix invalid PostScript for names with parentheses

The names in the .hp files may contain un-matched opening parentheses,
so escape them.

GHC Trac: #9517

Reviewers: bgamari, austin

Reviewed By: bgamari, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #9517

3 years agoPretty: remove a harmful $! (#12227)
Thomas Miedema [Sat, 16 Jul 2016 22:13:45 +0000 (00:13 +0200)] 
Pretty: remove a harmful $! (#12227)

This is backport of [1] for GHC's copy of Pretty. See Note [Differences
between libraries/pretty and compiler/utils/Pretty.hs].


Reviewers: bgamari, austin

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #12227

3 years agoCodeGen: Way to dump cmm only once (#11717)
Vladimir Trubilov [Sat, 16 Jul 2016 22:13:22 +0000 (00:13 +0200)] 
CodeGen: Way to dump cmm only once (#11717)

The `-ddump-cmm` put all stages of Cmm processing into one output.
This patch changes its behavior and adds two more options to make
Cmm dumping flexible.

- `-ddump-cmm-from-stg` dumps only initial version of  Cmm right after
   STG->Cmm codegen
- `-ddump-cmm` dumps the final result of the Cmm pipeline processing
- `-ddump-cmm-verbose` dumps intermediate output of each Cmm pipeline
- `-ddump-cmm-proc` and `-ddump-cmm-caf` seems were lost. Now enabled

Test Plan: ./validate

Reviewers: thomie, simonmar, austin, bgamari

Reviewed By: thomie, simonmar

Subscribers: simonpj, thomie

Differential Revision:

GHC Trac Issues: #11717

3 years agoBugfix for bug 11632: `readLitChar` should consume null characters
Ben Gamari [Sat, 16 Jul 2016 22:12:52 +0000 (00:12 +0200)] 
Bugfix for bug 11632: `readLitChar` should consume null characters

Test Plan: The tests have been included. This change deals with a
relatively minor edge case and should not break unrelated functionality.

Reviewers: thomie, #core_libraries_committee, ekmett, bgamari

Reviewed By: #core_libraries_committee, ekmett, bgamari

Subscribers: bgamari, ekmett

Differential Revision:

GHC Trac Issues: #11632

3 years agoBinary: Use ByteString's copy in getBS
Ben Gamari [Sat, 16 Jul 2016 21:41:46 +0000 (23:41 +0200)] 
Binary: Use ByteString's copy in getBS

It's unclear how much of an effect on runtime this will have, but if
nothing else the code generation may be a tad better since the system's
`memcpy` will be used.

Test Plan: Validate

Reviewers: simonmar, austin

Subscribers: thomie

Differential Revision:

3 years agoIfaceEnv: Only check for built-in OccNames if mod is GHC.Types
Ben Gamari [Sat, 16 Jul 2016 21:38:51 +0000 (23:38 +0200)] 
IfaceEnv: Only check for built-in OccNames if mod is GHC.Types

This check is not entirely cheap and will not succeed unless we are
looking for something in the module where built-in syntax lives,

Reviewers: simonpj, austin

Subscribers: simonpj, thomie, osa1

Differential Revision:

3 years agoLog heap profiler samples to event log
Ben Gamari [Thu, 16 Jun 2016 13:03:01 +0000 (15:03 +0200)] 
Log heap profiler samples to event log

Test Plan: Try it

Reviewers: hvr, simonmar, austin, erikd

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11094

3 years agoBring comments in TcGenGenerics up to date
Ryan Scott [Fri, 15 Jul 2016 18:17:24 +0000 (14:17 -0400)] 
Bring comments in TcGenGenerics up to date

[ci skip]

3 years agoAdded type family dependency to Data.Type.Bool.Not
Baldur Blöndal [Thu, 14 Jul 2016 22:09:03 +0000 (18:09 -0400)] 
Added type family dependency to Data.Type.Bool.Not


Signed-off-by: Baldur Blöndal <>
Reviewers: goldfire, RyanGlScott, austin, bgamari, hvr

Reviewed By: RyanGlScott, austin

Subscribers: RyanGlScott, thomie

Differential Revision:

GHC Trac Issues: #12057

3 years agotidyOccNames: Rename variables fairly
Joachim Breitner [Tue, 12 Jul 2016 15:21:07 +0000 (17:21 +0200)] 
tidyOccNames: Rename variables fairly

So that
> :t (id,id,id)
(id,id,id) :: (a3 -> a3, a2 -> a2, a1 -> a1)
instead of
(id,id,id) :: (a2 -> a2, a1 -> a1, a -> a)

Differential Revision:

3 years agotidyType: Rename variables of nested forall at once
Joachim Breitner [Tue, 12 Jul 2016 14:52:42 +0000 (16:52 +0200)] 
tidyType: Rename variables of nested forall at once

this refactoring commit prepares for fixing #12382, which can now be
implemented soley in tidyTyCoVarBndrs.

3 years agoDemand analyser: Implement LetUp rule (#12370)
Joachim Breitner [Wed, 6 Jul 2016 13:44:18 +0000 (15:44 +0200)] 
Demand analyser: Implement LetUp rule (#12370)

This makes the implementation match the description in the paper more
closely: There, a let binding that is not a function has first its body
analised, and then the binding’s RHS. This way, the demand on the bound
variable by the body can be fed into the RHS, yielding more precise

Performance measurements do unfortunately not show significant
improvements or regessions.

Differential Revision:

3 years agoPretty: delete really old changelog
Thomas Miedema [Mon, 11 Jul 2016 15:59:59 +0000 (17:59 +0200)] 
Pretty: delete really old changelog

This changelog is very incomplete, and basically useless. I'm removing
it, because it made it harder to compare this copy of `Pretty.hs` with
the copy in `libraries/pretty` (from which a similar changelog was
deleted some time ago).

3 years agoAdd -package-env to the flags reference
Simon Marlow [Sun, 10 Jul 2016 10:00:06 +0000 (11:00 +0100)] 
Add -package-env to the flags reference

3 years agocheck-api-annotations utility loads by filename
Alan Zimmerman [Sun, 10 Jul 2016 19:38:01 +0000 (21:38 +0200)] 
check-api-annotations utility loads by filename

Previously it loaded by modulename, which prevented loading files with a
Main module.

3 years agoTysWiredIn: Use UniqFM lookup for built-in OccNames
Ben Gamari [Sat, 9 Jul 2016 19:03:46 +0000 (21:03 +0200)] 
TysWiredIn: Use UniqFM lookup for built-in OccNames

Previously we would unpack the OccName into a String, then pattern match
against this string. Due to the implementation of `unpackFS`, this
actually unpacks the entire contents, even though we often only need to
look at the first few characters.

Here we take another approach: build a UniqFM with the known built-in
OccNames, allowing us to use `FastString`'s hash-based comparison

Reviewers: simonpj, austin, simonmar

Reviewed By: simonmar

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #12357

3 years agoTestsuite: expose TEST_CC (path to gcc)
Thomas Miedema [Sat, 9 Jul 2016 12:03:51 +0000 (14:03 +0200)] 
Testsuite: expose TEST_CC (path to gcc)

Reviewed by: Phyx

Differential Revision:

3 years agoDsExpr: Remove usage of concatFS in fingerprintName
Ben Gamari [Fri, 8 Jul 2016 20:41:55 +0000 (22:41 +0200)] 
DsExpr: Remove usage of concatFS in fingerprintName

This was the only user of concatFS and really just wants the `String`

Stumbled upon while looking at #12357.

Test Plan: Validate

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision:

3 years agoKill eltsUFM in classifyTyCons
Bartosz Nitka [Fri, 8 Jul 2016 14:40:48 +0000 (07:40 -0700)] 
Kill eltsUFM in classifyTyCons

GHC Trac: #4012

3 years agoOccName: Avoid re-encoding derived OccNames
Ben Gamari [Fri, 8 Jul 2016 13:38:23 +0000 (15:38 +0200)] 
OccName: Avoid re-encoding derived OccNames

Previously we would form derived OccNames by first decoding the name
being derived from, manipulating it in [Char] form, and then
re-encoding. This is all very wasteful as we essentially always just
want to concatenate. Instead we now take care to form the final name
with only one concatFS.

Test Plan: Validate, examing compiler allocations

Reviewers: simonpj, austin

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #12357

3 years agoOccName: Implement startsWithUnderscore in terms of headFS
Ben Gamari [Fri, 8 Jul 2016 12:09:36 +0000 (14:09 +0200)] 
OccName: Implement startsWithUnderscore in terms of headFS

This avoids decoding the entire string just to look at the first

Test Plan: Validate

Reviewers: austin

Subscribers: thomie

Differential Revision:

3 years agoFastString: Supply mconcat implementation
Ben Gamari [Fri, 8 Jul 2016 12:09:09 +0000 (14:09 +0200)] 
FastString: Supply mconcat implementation

Test Plan: Validate

Reviewers: austin

Subscribers: thomie

Differential Revision:

3 years agoFastString: Add IsString instance
Ben Gamari [Tue, 5 Jul 2016 10:06:29 +0000 (06:06 -0400)] 
FastString: Add IsString instance

3 years agoFastString: Reduce allocations of concatFS
Ben Gamari [Tue, 5 Jul 2016 00:33:57 +0000 (20:33 -0400)] 
FastString: Reduce allocations of concatFS

Instead of unpacking and then repacking we simply concatenate all of the
individual ByteStrings.

3 years agoGHC.Stack.CCS: Fix typo in Haddocks
Ben Gamari [Thu, 7 Jul 2016 17:42:46 +0000 (19:42 +0200)] 
GHC.Stack.CCS: Fix typo in Haddocks

3 years agoUse UniqDFM for InstEnv
Bartosz Nitka [Thu, 7 Jul 2016 14:56:49 +0000 (07:56 -0700)] 
Use UniqDFM for InstEnv

Rationale in the comment.
Also updates submodule array with test output changes.

GHC Trac: #4012

3 years agoUtils: Fix `lengthIs` and `lengthExceeds` for negative args
Ömer Sinan Ağacan [Thu, 7 Jul 2016 20:01:47 +0000 (20:01 +0000)] 
Utils: Fix `lengthIs` and `lengthExceeds` for negative args

Credits goes to SPJ for finding this.

3 years agoAdd Note [FamInstEnv determinism]
Bartosz Nitka [Thu, 7 Jul 2016 15:12:05 +0000 (08:12 -0700)] 
Add Note [FamInstEnv determinism]

I'm just turning previous commit message into a Note

GHC Trac: #4012

3 years agoCorrect the message displayed for syntax error (#12146)
Aditya [Sat, 25 Jun 2016 14:21:36 +0000 (19:51 +0530)] 
Correct the message displayed for syntax error (#12146)

3 years agoUse deterministic maps for FamInstEnv
Bartosz Nitka [Thu, 7 Jul 2016 11:02:20 +0000 (04:02 -0700)] 
Use deterministic maps for FamInstEnv

We turn FamInstEnvs into lists in some places which
don't directly affect the ABI. That happens in
family consistency checks and when producing output
for `:info`. Unfortunately that nondeterminism
is nonlocal and it's hard to tell locally what it
affects. Furthermore the envs should be relatively
small, so it should be free to use deterministic
maps here. Testing with nofib and ./validate detected
no difference between UniqFM and UniqDFM.

GHC Trac: #4012

3 years agoDocument some codegen nondeterminism
Bartosz Nitka [Thu, 7 Jul 2016 10:07:20 +0000 (03:07 -0700)] 
Document some codegen nondeterminism

Bit-for-bit reproducible binaries are not a goal for now,
so this is just marking places that could be a problem.
Doing this will allow eltsUFM to be removed and will
leave only nonDetEltsUFM.

GHC Trac: #4012

3 years agoStyle changes for UniqFM
Bartosz Nitka [Thu, 7 Jul 2016 09:31:51 +0000 (02:31 -0700)] 
Style changes for UniqFM

This file used the old style with type signatures
separated from the code. As far as I understand
the idea was to generate PostScript files from
the source. I think the idea was abandoned and
this more modern style is more common in the

Test Plan: it still compiles

Reviewers: austin, simonmar, bgamari

Reviewed By: simonmar, bgamari

Subscribers: thomie

Differential Revision:

3 years ago--without-libcharset disables the use of libcharset
Simon Marlow [Wed, 6 Jul 2016 12:47:22 +0000 (05:47 -0700)] 
--without-libcharset disables the use of libcharset

3 years agoShow testcase where demand analysis abortion code fails
Joachim Breitner [Thu, 7 Jul 2016 08:41:38 +0000 (10:41 +0200)] 
Show testcase where demand analysis abortion code fails

By making it believe that some deeply nested value is absent when it
really isn't. See #12368.

3 years agoSwitch to LLVM version 3.8
Erik de Castro Lopo [Wed, 6 Jul 2016 19:38:14 +0000 (05:38 +1000)] 
Switch to LLVM version 3.8

LLVM 3.8 was released a couple of months ago.

Test Plan: Build and test on x86_64/linux (perf-llvm) and armhf/linux.

Reviewers: austin, hvr, rwbarton, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

3 years agoMention addModFinalizer changes in release notes.
Facundo Domínguez [Wed, 6 Jul 2016 14:18:58 +0000 (11:18 -0300)] 
Mention addModFinalizer changes in release notes.

3 years agoHave addModFinalizer expose the local type environment.
Facundo Domínguez [Wed, 6 Jul 2016 09:48:27 +0000 (06:48 -0300)] 
Have addModFinalizer expose the local type environment.

This annotates the splice point with 'HsSpliced ref e' where 'e' is the
result of the splice. 'ref' is a reference that the typechecker will fill with
the local type environment.

The finalizer then reads the ref and uses the local type environment, which
causes 'reify' to find local variables when run in the finalizer.

Test Plan: ./validate

Reviewers: simonpj, simonmar, bgamari, austin, goldfire

Reviewed By: goldfire

Subscribers: simonmar, thomie, mboes

Differential Revision:

GHC Trac Issues: #11832

3 years agoAdds x86_64-apple-darwin14 target.
Moritz Angermann [Tue, 5 Jul 2016 18:32:22 +0000 (20:32 +0200)] 
Adds x86_64-apple-darwin14 target.

x86_64-apple-darwin14, is the target for the 64bit simulator.
Ideally, we'd have (i386|armv7|arm64|x64_86)-apple-ios, yet,
many #ifdefs depend on `darwin`, notably libffi. Hence, this only adds
x86_64-apple-darwin14 as a target. This also updates the comment to
add the `-S` flag, and dump the output to stdout; and adjusts the
`datalayout` and `triple` values, as obtained through the method
mentioned in the comment.

Reviewers: hvr, erikd, austin, bgamari, simonmar

Reviewed By: simonmar

Subscribers: thomie

Differential Revision:

3 years agoFix GetTime.c on Darwin with clock_gettime
Misty De Meo [Wed, 15 Jun 2016 22:02:13 +0000 (15:02 -0700)] 
Fix GetTime.c on Darwin with clock_gettime

On Darwin versions with clock_gettime, #ifdefs will prevent the
mach-specific time functions from being used in most places, and
the mach time headers won't be included; however, this section
was guarded incorrectly and would still try to use them.

Fixes #12195.

3 years agoRemove varEnvElts
Bartosz Nitka [Tue, 5 Jul 2016 16:50:02 +0000 (09:50 -0700)] 
Remove varEnvElts

varEnvElts can introduce unnecessary nondeterminism
and we can finally remove it, so that no one will use
it by accident. If someone wants to use varEnvElts they
should either use DVarEnv or use nonDetEltsUFM and document
why it doesn't introduce nondeterminism.

GHC Trac: #4012

3 years agoKill varEnvElts in zonkEnvIds
Bartosz Nitka [Tue, 5 Jul 2016 16:01:34 +0000 (09:01 -0700)] 
Kill varEnvElts in zonkEnvIds

This localizes the nondeterminism that varEnvElts could
have introduced, so that it's obvious that it's benign.

Test Plan: ./validate

Reviewers: simonpj, austin, bgamari

Subscribers: thomie, simonmar

Differential Revision:

GHC Trac Issues: #4012

3 years agoDocument codegen nondeterminism
Bartosz Nitka [Tue, 5 Jul 2016 16:42:44 +0000 (09:42 -0700)] 
Document codegen nondeterminism

We don't care about bit-for-bit reproducibility, so
I'm just documenting this as a possible source.

GHC Trac: #4012

3 years agoTest Trac #12133
Simon Peyton Jones [Tue, 5 Jul 2016 15:23:01 +0000 (16:23 +0100)] 
Test Trac #12133

3 years agoWhite space only
Simon Peyton Jones [Tue, 5 Jul 2016 15:22:17 +0000 (16:22 +0100)] 
White space only

3 years agoTidy up tidying
Simon Peyton Jones [Tue, 5 Jul 2016 12:49:02 +0000 (13:49 +0100)] 
Tidy up tidying

This is a tiny refactor, replacing an ad-hoc local function
(TidyPgm.loookup_aux_id) with a solid global one (tidyVarOcc).

3 years agoMake unique auxiliary function names in deriving
Simon Peyton Jones [Tue, 5 Jul 2016 12:46:29 +0000 (13:46 +0100)] 
Make unique auxiliary function names in deriving

In deriving for Data, we make some auxiliary functions, but they
didn't always get distinct names (Trac #12245).  This patch fixes
it by using the same mechanism as for dictionary functions, namely

Some assocated refactoring came along for the ride.

3 years agoDelete out-of-date comment
Simon Peyton Jones [Mon, 4 Jul 2016 14:11:21 +0000 (15:11 +0100)] 
Delete out-of-date comment

3 years agoUse DVarEnv for vectInfoVar
Bartosz Nitka [Tue, 5 Jul 2016 13:23:54 +0000 (06:23 -0700)] 
Use DVarEnv for vectInfoVar

This makes sure that we don't introduce unnecessary
nondeterminism from vectorization.

Also updates dph submodule to reflect the change in types.

GHC Trac: #4012

3 years agoExtra ASSERTs for nameModule
Simon Peyton Jones [Mon, 4 Jul 2016 17:34:12 +0000 (18:34 +0100)] 
Extra ASSERTs for nameModule

3 years agoCheck generic-default method for ambiguity
Simon Peyton Jones [Fri, 1 Jul 2016 21:33:33 +0000 (22:33 +0100)] 
Check generic-default method for ambiguity

Fixes Trac #7497 and #12151.   In some earlier upheaval I introduced
a bug in the ambiguity check for genreric-default method.

This patch fixes it.  But in fixing it I realised that the
sourc-location of any such error message was bogus, so I fixed
that too, which involved a slightly wider change; see the
comments with TcMethInfo.

3 years agoKill some varEnvElts
Bartosz Nitka [Tue, 5 Jul 2016 10:37:06 +0000 (03:37 -0700)] 
Kill some varEnvElts

I was able to hide the nondeterminism in some specialized
function, which I believe will be useful in other places.

GHC Trac: #4012

3 years agoRevert "Linker: some extra debugging / logging"
Simon Marlow [Tue, 5 Jul 2016 07:41:14 +0000 (08:41 +0100)] 
Revert "Linker: some extra debugging / logging"

This reverts commit 6377757918c1e7f63638d6f258cad8d5f02bb6a7.

3 years agoRevert "Fix 32-bit build failures"
Simon Marlow [Tue, 5 Jul 2016 07:40:52 +0000 (08:40 +0100)] 
Revert "Fix 32-bit build failures"

This reverts commit 01f449f4ffd2c4f23bfe5698b9f1b98a86276900.

3 years agoEnum: Ensure that operations on Word fuse
Ben Gamari [Mon, 4 Jul 2016 12:36:44 +0000 (14:36 +0200)] 
Enum: Ensure that operations on Word fuse

Test Plan: Validate, verify fusion

Reviewers: austin, hvr

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #12354

3 years agoCallArity: Use not . null instead of length > 0
Ben Gamari [Mon, 4 Jul 2016 12:36:24 +0000 (14:36 +0200)] 
CallArity: Use not . null instead of length > 0

Test Plan: Validate

Reviewers: austin

Subscribers: thomie

Differential Revision:

3 years agousers-guide: Remove static field type from rts-flag
Ben Gamari [Fri, 1 Jul 2016 12:56:01 +0000 (14:56 +0200)] 
users-guide: Remove static field type from rts-flag

This was introduced by a cut-and-paste error.

3 years agoTreat duplicate pattern synonym signatures as an error
Seraphime Kirkovski [Fri, 1 Jul 2016 12:30:10 +0000 (14:30 +0200)] 
Treat duplicate pattern synonym signatures as an error

Fixes issue T12165 by banning duplicate pattern synonyms
signatures. This seems to me the best solution because:

   1) it is coherent with the way we treat other duplicate signatures

   2) the typechecker currently doesn't try to apply a second
       signature to a pattern to see if it matches, probably because
       it assumes there is no more than one signature per object.

Test Plan: ./validate

Reviewers: goldfire, austin, mpickering, bgamari

Reviewed By: mpickering, bgamari

Subscribers: mpickering, thomie

Differential Revision:

GHC Trac Issues: #12165

3 years agotestsuite: Add testcase for #12355
Ben Gamari [Fri, 1 Jul 2016 12:29:54 +0000 (14:29 +0200)] 
testsuite: Add testcase for #12355

Test Plan: Validate

Reviewers: austin, osa1

Reviewed By: osa1

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #12355

3 years agousers-guide: Note multiple pattern signature change in relnotes
Ben Gamari [Fri, 1 Jul 2016 12:27:00 +0000 (14:27 +0200)] 
users-guide: Note multiple pattern signature change in relnotes

3 years agobase: Add release date to changelog
Ben Gamari [Sat, 7 May 2016 07:30:20 +0000 (09:30 +0200)] 
base: Add release date to changelog

3 years agoMkCore: Fix some note names
Ömer Sinan Ağacan [Mon, 4 Jul 2016 13:51:27 +0000 (13:51 +0000)] 
MkCore: Fix some note names

3 years agoFix 32-bit build failures
Simon Marlow [Mon, 4 Jul 2016 09:56:04 +0000 (10:56 +0100)] 
Fix 32-bit build failures

3 years agoKill varEnvElts in seqDmdEnv
Bartosz Nitka [Fri, 1 Jul 2016 13:50:55 +0000 (06:50 -0700)] 
Kill varEnvElts in seqDmdEnv

GHC Trac: #4012

3 years agoDocument some benign nondeterminism
Bartosz Nitka [Fri, 1 Jul 2016 14:29:08 +0000 (07:29 -0700)] 
Document some benign nondeterminism

3 years agoRemove uniqSetToList
Bartosz Nitka [Fri, 1 Jul 2016 11:58:39 +0000 (04:58 -0700)] 
Remove uniqSetToList

This documents nondeterminism in code generation and removes
the nondeterministic ufmToList function. In the future someone
will have to use nonDetEltsUFM (with proper explanation)
or pprUFM.

3 years agoLinker: some extra debugging / logging
Simon Marlow [Wed, 29 Jun 2016 20:50:18 +0000 (21:50 +0100)] 
Linker: some extra debugging / logging

3 years agoRemove unused oc->isImportLib (#12230)
Simon Marlow [Wed, 29 Jun 2016 20:48:43 +0000 (21:48 +0100)] 
Remove unused oc->isImportLib (#12230)

This field is never set, but it was being tested and used to decide
whether to resolve an object or not.  This caused non-deterministic
crashes when using the RTS linker (see #12230).

I suspect this is not the correct fix, but putting it up so that Phyx
can tell us what the right fix should be.

Test Plan: validate

Reviewers: austin, Phyx, bgamari, erikd

Subscribers: erikd, thomie, ezyang

Differential Revision:

GHC Trac Issues: #12230

3 years agorules/ stop xelatex on error
Markus Rothe [Sun, 26 Jun 2016 09:28:36 +0000 (11:28 +0200)] 
rules/ stop xelatex on error

This avoids the interactive prompt of xelatex on error.

3 years agoAllow one type signature for multiple pattern synonyms
Matthew Pickering [Thu, 30 Jun 2016 23:15:01 +0000 (01:15 +0200)] 
Allow one type signature for multiple pattern synonyms

This makes pattern synonym signatures more consistent with normal
type signatures.

Updates haddock submodule.

Differential Revision:

3 years agoAdd NamedThing (GenLocated l e) instance
Ben Gamari [Fri, 1 Jul 2016 10:23:27 +0000 (12:23 +0200)] 
Add NamedThing (GenLocated l e) instance

3 years agousers-guide: Fix markup in release notes
Ben Gamari [Thu, 30 Jun 2016 18:07:41 +0000 (20:07 +0200)] 
users-guide: Fix markup in release notes

3 years agoTestsuite: be less strict about topHandler03's stderr
Thomas Miedema [Fri, 1 Jul 2016 09:16:08 +0000 (11:16 +0200)] 
Testsuite: be less strict about topHandler03's stderr

Fixes #12343.

3 years agoFix check_uniques in non-unicode locale
Thomas Miedema [Thu, 30 Jun 2016 08:32:00 +0000 (10:32 +0200)] 
Fix check_uniques in non-unicode locale

Testcase: `LC_ALL=C make -C utils/checkUniques`. Works with python2 and

Reviewed by: bgamari

Differential Revision:

3 years agoCmmExpr: remove unused `vgcFlag` function
Michal Terepeta [Thu, 30 Jun 2016 16:45:54 +0000 (18:45 +0200)] 
CmmExpr: remove unused `vgcFlag` function

Test Plan: validate

Reviewers: austin, bgamari, simonmar

Reviewed By: bgamari, simonmar

Subscribers: thomie

Differential Revision:

3 years agoghc-pkg: Drop trailing slashes in computing db paths
Ben Gamari [Mon, 20 Jun 2016 07:25:05 +0000 (09:25 +0200)] 
ghc-pkg: Drop trailing slashes in computing db paths

Test Plan: Validate, try tests in ticket

Reviewers: austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #12194

3 years agonativeGen: Allow -fregs-graph to be used
Ben Gamari [Mon, 20 Jun 2016 07:24:41 +0000 (09:24 +0200)] 
nativeGen: Allow -fregs-graph to be used

Previously the flag was silently ignored due the #7679 and #8657. This,
however, seems unnecessarily brutal and makes experimentation unduly
difficult for users.

Test Plan: Validate

Reviewers: austin, simonmar

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #7679, #8657

3 years agoTrac #11554 fix loopy GADTs
Alexander Vieth [Mon, 20 Jun 2016 07:22:18 +0000 (09:22 +0200)] 
Trac #11554 fix loopy GADTs

Summary: Fixes T11554

Reviewers: goldfire, thomie, simonpj, austin, bgamari

Reviewed By: thomie, simonpj, bgamari

Subscribers: simonpj, goldfire, thomie

Differential Revision:

GHC Trac Issues: #11554

3 years agoUpdates to handle new Cabal
Edward Z. Yang [Mon, 20 Jun 2016 07:02:34 +0000 (09:02 +0200)] 
Updates to handle new Cabal

Specifically per-component macros and multiple libraries.

Contains Cabal submodule update.

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

Reviewers: austin, bgamari

Reviewed By: austin, bgamari

Subscribers: hvr, thomie

Differential Revision:

3 years agoAxe RecFlag on TyCons.
Edward Z. Yang [Fri, 24 Jun 2016 18:03:47 +0000 (11:03 -0700)] 
Axe RecFlag on TyCons.

This commit removes the information about whether or not
a TyCon is "recursive", as well as the code responsible
for calculating this information.

The original trigger for this change was complexity regarding
how we computed the RecFlag for hs-boot files.  The problem
is that in order to determine if a TyCon is recursive or
not, we need to determine if it was defined in an hs-boot
file (if so, we conservatively assume that it is recursive.)

It turns that doing this is quite tricky.  The "obvious"
strategy is to typecheck the hi-boot file (since we are
eventually going to need the typechecked types to check
if we properly implemented the hi-boot file) and just extract
the names of all defined TyCons from the ModDetails, but
this actually does not work well if Names from the hi-boot
file are being knot-tied via if_rec_types: the "extraction"
process will force thunks, which will force the typechecking
process earlier than we have actually defined the types

Rather than work around all this trickiness (it certainly
can be worked around, either by making interface loading
MORE lazy, or just reading of the set of defined TyCons
directly from the ModIface), we instead opted to excise
the source of the problem, the RecFlag.

For one, it is not clear if the RecFlag even makes sense,
in the presence of higher-orderness:

    data T f a = MkT (f a)

T doesn't look recursive, but if we instantiate f with T,
then it very well is!  It was all very shaky.

So we just don't bother anymore.  This has two user-visible

1. is_too_recursive now assumes that all TyCons are
recursive and will bail out in a way that is still mysterious
to me if there are too many TyCons.

2. checkRecTc, which is used when stripping newtypes to
get to representation, also assumes all TyCons are
recursive, and will stop running if we hit the limit.

The biggest risk for this patch is that we specialize less
than we used to; however, the codeGen tests still seem to
be passing.

Signed-off-by: Edward Z. Yang <>
Reviewers: simonpj, austin, bgamari

Subscribers: goldfire, thomie

Differential Revision:

3 years agoRemove ufmToList
Bartosz Nitka [Thu, 30 Jun 2016 15:20:41 +0000 (08:20 -0700)] 
Remove ufmToList

This documents nondeterminism in code generation and removes
the nondeterministic ufmToList function. In the future someone
will have to use nonDetUFMToList (with proper explanation)
or pprUFMWithKeys.

3 years agoReorganize some determinism tests
Bartosz Nitka [Thu, 30 Jun 2016 14:18:22 +0000 (07:18 -0700)] 
Reorganize some determinism tests

This directory structure makes it easier to find the tests

3 years agoAdd a new determinism test
Bartosz Nitka [Thu, 30 Jun 2016 13:59:02 +0000 (06:59 -0700)] 
Add a new determinism test

This is one of the testcases that I forgot to commit

3 years agoDelete Ord Unique
Bartosz Nitka [Wed, 29 Jun 2016 14:34:55 +0000 (07:34 -0700)] 
Delete Ord Unique

Ord Unique can be a source of invisible, accidental
nondeterminism as explained in Note [No Ord for Unique].
This removes it, leaving a note with rationale.

It's unfortunate that I had to write Ord instances for
codegen data structures by hand, but I believe that it's a
right trade-off here.

Test Plan: ./validate

Reviewers: simonmar, austin, bgamari

Reviewed By: simonmar

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4012

3 years agoTestsuite: do not depend on sys.stdout.encoding
Thomas Miedema [Wed, 29 Jun 2016 20:56:58 +0000 (22:56 +0200)] 
Testsuite: do not depend on sys.stdout.encoding

The cause of #12213 is in dump_stdout and dump_stderr:


Commit 6f6f515401a29d26eaa5daae308b8e700abd4c04 changed read_no_crs to
return a unicode string. Printing a unicode strings works fine as long
as sys.stdout.encoding is 'UTF-8'.

There are two reasons why sys.stdout.encoding might not be 'UTF-8'.

* When output is going to a file, sys.stdout and sys.stdout do not respect
  the locale:

  $ LC_ALL=en_US.utf8 python -c 'import sys; print(sys.stderr.encoding)'
  $ LC_ALL=en_US.utf8 python -c 'import sys; print(sys.stderr.encoding)' 2>/dev/null

* When output is going to the terminal, explicitly reopening sys.stdout has
  the side-effect of changing sys.stdout.encoding from 'UTF-8' to 'None'.

      sys.stdout = os.fdopen(sys.__stdout__.fileno(), "w", 0)

  We currently do this to set a buffersize of 0 (the actual
  buffersize used is irrelevant for the sys.stdout.encoding problem).

Solution: fix dump_stdout and dump_stderr to not use read_no_crs.

3 years agoFix pretty-printer for IfaceCo
Simon Peyton Jones [Wed, 29 Jun 2016 22:21:49 +0000 (23:21 +0100)] 
Fix pretty-printer for IfaceCo

As Trac #12242 showed, there was a missing case in
the pretty printer for IfaceCo. I've refactored it
so that the pattern-match ovelap checker will spot
it next time.

3 years agoTestsuite: use ignore_stderr/stdout instead of ignore_output
Thomas Miedema [Fri, 24 Jun 2016 18:45:04 +0000 (20:45 +0200)] 
Testsuite: use ignore_stderr/stdout instead of ignore_output

The problem with ignore_output is that it hides errors for WAY=ghci.
GHCi always returns with exit code 0 (unless it is broken itself).

For example: ghci015 must have been failing with compile errors for
years, but we didn't notice because all output was ignored.

Therefore, replace all uses of ignore_output with either ignore_stderr
or ignore_stdout. In some cases I opted for adding the expected output.

Update submodule hpc and stm.

Reviewed by: simonmar

Differential Revision:

3 years agoDouble the file descriptor limit for openFile008
Bartosz Nitka [Wed, 29 Jun 2016 13:10:20 +0000 (06:10 -0700)] 
Double the file descriptor limit for openFile008

I have get test failures on `openFile008` with
`openFile: resource exhausted (Too many open files)` when running
inside `./validate`, but not when I run the test individually.
I suspect that's because with `./validate` parallelism of 33 threads
I go just above the `1024` file descriptor limit.
This is probably related to the recent change:
`58f0086b70f2: Testsuite: open/close stdin/stdout/stderr explicitly`
but I haven't looked deep enough to understand exactly how.
I think bumping this is harmless, but I don't really know why it's
necessary at all.

Test Plan: ./validate

Reviewers: austin, thomie, hvr, bgamari, simonmar

Reviewed By: simonmar

Subscribers: simonmar

Differential Revision:

3 years agoRefactor match to not use Unique order
Bartosz Nitka [Wed, 29 Jun 2016 10:27:49 +0000 (03:27 -0700)] 
Refactor match to not use Unique order

Unique order can introduce nondeterminism.
As a step towards removing the Ord Unique instance
I've refactored the code to use deterministic sets instead.

Test Plan: ./validate

Reviewers: simonmar, austin, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4012

3 years agoTestsuite: fixes for python2.6 support
Thomas Miedema [Wed, 29 Jun 2016 11:16:05 +0000 (13:16 +0200)] 
Testsuite: fixes for python2.6 support

3 years agoTest Trac #12185
Simon Peyton Jones [Wed, 29 Jun 2016 09:41:55 +0000 (10:41 +0100)] 
Test Trac #12185

3 years agoStop the simplifier from removing StaticPtr binds.
Facundo Domínguez [Tue, 28 Jun 2016 01:30:50 +0000 (22:30 -0300)] 
Stop the simplifier from removing StaticPtr binds.

We have the FloatOut pass create exported ids for floated StaticPtr
bindings. The simplifier doesn't try to remove those.

This patch also improves on 7fc20b by making a common definition
collectStaticPtrSatArgs to test for StaticPtr binds.

Fixes #12207.

Test Plan: ./validate

Reviewers: simonpj, austin, bgamari, simonmar, goldfire

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #12207

3 years agoWibble error message for #11471
Simon Peyton Jones [Tue, 28 Jun 2016 12:39:51 +0000 (13:39 +0100)] 
Wibble error message for #11471

I'm not quite sure why this changed with my two recent commits,
but it /has/ changed (in a benign way) so I'm accepting it.
Maybe it wasn't me anyway... but life is short and I'm not inclined
to dig further.

3 years agoDeal correctly with unused imports for 'coerce'
Simon Peyton Jones [Tue, 28 Jun 2016 11:13:13 +0000 (12:13 +0100)] 
Deal correctly with unused imports for 'coerce'

We only do newtype unwrapping for Coercible constraints if
the newtype's data constructor is in scope.  We were trying to
record the fact that the data constructor was thereby 'used', so
that an import statement would not be flagged as unnecsssary
(by -Wunused-imports).

But the code was simply wrong. It was wrong because it assumed
that only one level of unwrapping happened, whereas
tcTopNormaliseNewTypeTF_maybe actually unwraps multiple layers.
So we need to return a /list/ of data constructors that are used.

This entailed a bit of refactoring, as usual.

Fixes Trac #12067

3 years agoDon't omit any evidence bindings
Simon Peyton Jones [Fri, 24 Jun 2016 14:49:05 +0000 (15:49 +0100)] 
Don't omit any evidence bindings

This fixes Trac #12156, where we were omitting to make an
evidence binding (because cec_suppress was on), but yet the
program was compiled and run.

The fix is easy, and involves deleting code :-).

3 years agoTestsuite: mark tests expect_broken
Thomas Miedema [Mon, 27 Jun 2016 21:12:19 +0000 (23:12 +0200)] 
Testsuite: mark tests expect_broken

* T7837 is still broken for prof_ways (#9406)
* T11627b is broken on Windows for WAY=prof_hc_hb (#12236)
* T8089 is also broken for WAY=profasm on Windows

3 years agoTestsuite: do not add -debug explicitly in .T file
Thomas Miedema [Mon, 27 Jun 2016 22:21:58 +0000 (00:21 +0200)] 
Testsuite: do not add -debug explicitly in .T file

This prevents `cannot find -lHSrts_debug_p` when running `make
TEST=T9078 WAY=profasm` (#9078).

3 years agoTestsuite: run all indexed-types ways on ./validate --slow
Thomas Miedema [Mon, 27 Jun 2016 21:11:48 +0000 (23:11 +0200)] 
Testsuite: run all indexed-types ways on ./validate --slow

I don't know why some ways were omitted before.

3 years agoTestsuite: framework failure improvements (#11165)
Thomas Miedema [Fri, 24 Jun 2016 14:18:05 +0000 (16:18 +0200)] 
Testsuite: framework failure improvements (#11165)

* add framework failures to unexpected results list
* report errors in .T files as framework failures (show in summary)
* don't report missing tests when framework failures in .T files