5 years agoFix cppcheck warnings
Boris Egorov [Tue, 16 Sep 2014 12:55:06 +0000 (07:55 -0500)] 
Fix cppcheck warnings

Cppcheck found a few defects in win32 IOManager and a typo in rts
testsuite. This commit fixes them.

Cppcheck 1.54 founds three possible null pointer dereferences of ioMan
pointer. It is dereferenced and checked for NULL after that.

testheapalloced.c contains typo in printf statement, which should print
percent sign but treated as parameter placement by compiler. To properly
print percent sign one need to use "%%" string.

FYI: Cppcheck 1.66 cannot find possible null pointer dereferences in
mentioned places, mistakenly thinking that some memory leaking instead.
I probably fill a regression bug to Cppcheck.

Test Plan:
Build project, run 'make fulltest'. It finished with 28 unexpected
failures. I don't know if they are related to my fix.

    Unexpected results from:
    TEST="T3500b T7891 tc124 T7653 T5321FD T5030 T4801 T6048 T5631 T5837 T5642 T9020 T3064 parsing001 T1969 T5321Fun T783 T3294"

    OVERALL SUMMARY for test run started at Tue Sep  9 16:46:27 2014 NOVT
     4:23:24 spent to go through
        4101 total tests, which gave rise to
       16075 test cases, of which
        3430 were skipped

         315 had missing libraries
       12154 expected passes
         145 expected failures

           3 caused framework failures
           0 unexpected passes
          28 unexpected failures

    Unexpected failures:
       ../../libraries/base/tests  T7653 [bad exit code] (ghci,threaded1,threaded2)
       perf/compiler               T1969 [stat not good enough] (normal)
       perf/compiler               T3064 [stat not good enough] (normal)
       perf/compiler               T3294 [stat not good enough] (normal)
       perf/compiler               T4801 [stat not good enough] (normal)
       perf/compiler               T5030 [stat not good enough] (normal)
       perf/compiler               T5321FD [stat not good enough] (normal)
       perf/compiler               T5321Fun [stat not good enough] (normal)
       perf/compiler               T5631 [stat not good enough] (normal)
       perf/compiler               T5642 [stat not good enough] (normal)
       perf/compiler               T5837 [stat not good enough] (normal)
       perf/compiler               T6048 [stat not good enough] (optasm)
       perf/compiler               T783 [stat not good enough] (normal)
       perf/compiler               T9020 [stat not good enough] (optasm)
       perf/compiler               parsing001 [stat not good enough] (normal)
       typecheck/should_compile    T7891 [exit code non-0] (hpc,optasm,optllvm)
       typecheck/should_compile    tc124 [exit code non-0] (hpc,optasm,optllvm)
       typecheck/should_run        T3500b [exit code non-0] (hpc,optasm,threaded2,dyn,optllvm)

Reviewers: austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

5 years agoFind the target gcc when cross-compiling
Reid Barton [Tue, 16 Sep 2014 12:54:43 +0000 (07:54 -0500)] 
Find the target gcc when cross-compiling

"./configure --target=TARGET" was broken; it would use the host gcc.
(So you had to explicitly specify "--with-gcc=TARGET-gcc" also,
as a workaround.)

This was broken by commit fc4856f9e811d9a23ae9212f43a09ddf5ef12b26
for #8148. A comment claimed that FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL
was the same as FP_ARG_WITH_PATH_GNU_PROG except for not raising
an error when the program isn't found; but that wasn't true --
the former didn't prepend the target name when cross-compiling.

We actually need three versions of FP_ARG_WITH_PATH_GNU_PROG since
the LLVM tools are usually not prefixed with the target name even
when cross-compiling. So I generalized the logic in a single macro.

Test Plan:
Built with "./configure --target=i386-unknown-linux"
and BuildFlavour=quick, successfully

Reviewers: ezyang, austin

Reviewed By: ezyang, austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

5 years agoAdd special stdout for hClose002 on x64 Solaris
Kjetil Limkjær [Tue, 16 Sep 2014 12:54:15 +0000 (07:54 -0500)] 
Add special stdout for hClose002 on x64 Solaris

This is identical to the x86 output from bug #4290,
and fixes the hClose002 test when running under

Test Plan: Re-run 'make TEST=hClose002' under x64 Solaris.

Reviewers: ezyang, austin

Reviewed By: ezyang, austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

5 years agohaskeline: update submodule to fix Windows breakage
Austin Seipp [Tue, 16 Sep 2014 12:51:38 +0000 (07:51 -0500)] 
haskeline: update submodule to fix Windows breakage

Signed-off-by: Austin Seipp <>
5 years agoFollow-up to 72d6d0c2704ee6d9 updating submodules for real
Herbert Valerio Riedel [Tue, 16 Sep 2014 10:20:45 +0000 (12:20 +0200)] 
Follow-up to 72d6d0c2704ee6d9 updating submodules for real

5 years agoUpdate config.{guess,sub} to GNU automake 1.14.1
Herbert Valerio Riedel [Tue, 16 Sep 2014 10:14:31 +0000 (12:14 +0200)] 
Update config.{guess,sub} to GNU automake 1.14.1

The new versions should work better under MSYS2

A few submodules' `config.{guess,sub}` files were updated as well

With this commit, all config.{guess,sub} files in the GHC tree have the md5sums

    0fb81517303511f05a01b14f41cec2cf  config.guess
    d2a165dceaa5ac1edba3c512f6ca7bd1  config.sub

This addresses #9597

5 years agoMark T8639_api/T8628 as PHONY
Edward Z. Yang [Mon, 15 Sep 2014 22:11:41 +0000 (15:11 -0700)] 
Mark T8639_api/T8628 as PHONY

Signed-off-by: Edward Z. Yang <>
5 years agoDeclare official GitHub home of libraries/filepath
Herbert Valerio Riedel [Mon, 15 Sep 2014 21:11:36 +0000 (23:11 +0200)] 
Declare official GitHub home of libraries/filepath

Effective immediately, pushing to libraries/filepath requires
pushing to ssh://

5 years agoDon't offer hidden modules for autocomplete.
Edward Z. Yang [Mon, 15 Sep 2014 20:14:30 +0000 (13:14 -0700)] 
Don't offer hidden modules for autocomplete.

It was annoying to test GHCi directly, so I added a ghc-api unit test
of the function instead.

Signed-off-by: Edward Z. Yang <>
5 years agobase: Add some notes about the default impl of '(>>)'
Austin Seipp [Mon, 15 Sep 2014 10:02:21 +0000 (05:02 -0500)] 
base: Add some notes about the default impl of '(>>)'

See Note [Recursive bindings for Applicative/Monad]. This documents the
tricky little details that kept me occupied for so long with this patch,
and why exactly we deviate from the original proposal.

Signed-off-by: Austin Seipp <>
5 years agobase: Remove bunk default impl of (>>=)
Austin Seipp [Mon, 15 Sep 2014 01:35:09 +0000 (20:35 -0500)] 
base: Remove bunk default impl of (>>=)

Without 'join' as a part of Monad, this default implementation is bogus,
and is a leftover from d94de87252d0fe2ae9.

Signed-off-by: Austin Seipp <>
5 years agoExport `Traversable()` and `Foldable()` from Prelude
Herbert Valerio Riedel [Mon, 15 Sep 2014 06:37:30 +0000 (08:37 +0200)] 
Export `Traversable()` and `Foldable()` from Prelude

This exposes *only* the type-classes w/o any of their methods.
This is the very first step for implementing BPP (see #9586), which
already requires breaking up several import-cycles leading back to `Prelude`.

Ideally, importing `Prelude` should be avoided in most `base` modules,
as `Prelude` does not define any entities, but rather re-exports
existing ones.

Test Plan: validate passes

Reviewers: ekmett, austin

Reviewed By: ekmett, austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

GHC Trac Issues: #9586

5 years agoTweak perf-numbers for T1969 and T4801
Herbert Valerio Riedel [Sun, 14 Sep 2014 10:33:57 +0000 (12:33 +0200)] 
Tweak perf-numbers for T1969 and T4801

Right now, Phab's buildbot complains about

  Unexpected failures:
    perf/compiler T1969 [stat too good] (normal)
    perf/compiler T4801 [stat not good enough] (normal)

However, on my workstation, those tests don't fail (c.f. P14).
So this commit tries to blindly tweak those numbers and see if
if Phabricator succeeds to build this code-revision...

Test Plan: Let Harbormaster build it

Reviewers: austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

5 years agoUpdate libffi-tarballs submodule to libffi 3.1 (re #8701)
Herbert Valerio Riedel [Sat, 13 Sep 2014 17:55:25 +0000 (19:55 +0200)] 
Update libffi-tarballs submodule to libffi 3.1 (re #8701)

5 years agoUpdate haskell2010 submodule
Herbert Valerio Riedel [Sat, 13 Sep 2014 17:10:02 +0000 (19:10 +0200)] 
Update haskell2010 submodule kill "Kill CPP conditionals for HUGS and old GHCs"

5 years agoDetabify primops.txt.pp
Herbert Valerio Riedel [Sat, 13 Sep 2014 16:34:08 +0000 (18:34 +0200)] 
Detabify primops.txt.pp

5 years agoMove docstring of `seq` to primops.txt.pp
Herbert Valerio Riedel [Sat, 13 Sep 2014 16:14:55 +0000 (18:14 +0200)] 
Move docstring of `seq` to primops.txt.pp

The documentation for `seq` was recently augmented via #9390 &
cbfa107604f4cbfaf02bd633c1faa6ecb90c6dd7. However, it doesn't show
up in the Haddock generated docs because `#ifdef __HADDOCK__` doesn't
work as expected.  Also, it's easier to just fix the problem at the
origin (which in this is case is the primops.txt.pp file).

The benefit/downside of this is that now the extended documentation
shows up everywhere `seq` is re-exported directly.

5 years agoFixup test-case broken by Follow-up to b53c95fe621
Herbert Valerio Riedel [Sat, 13 Sep 2014 13:01:16 +0000 (15:01 +0200)] 
Fixup test-case broken by Follow-up to b53c95fe621

5 years agoFollow-up to b53c95fe621d3a66a82e6dad383e1c0c08f3871e
Herbert Valerio Riedel [Sat, 13 Sep 2014 11:24:38 +0000 (13:24 +0200)] 
Follow-up to b53c95fe621d3a66a82e6dad383e1c0c08f3871e

Forgot to fix-up the `haskell2010` and `haskell98` submodules in the previous

5 years agoMove ($!) from Prelude into GHC.Base
Herbert Valerio Riedel [Sat, 13 Sep 2014 09:56:37 +0000 (11:56 +0200)] 
Move ($!) from Prelude into GHC.Base

I don't see any reason why this needs to be in Prelude, where it makes
life harder to avoid import cycles involving Prelude. Ideally, the
`Prelude` module should only re-export entities from other modules, and
not define anything on its own.

So this moves `($!)` close to the definition of its `($)` cousin.

5 years agobase: Drop obsolete/redundant `__GLASGOW_HASKELL__` checks
Herbert Valerio Riedel [Sat, 13 Sep 2014 08:44:20 +0000 (10:44 +0200)] 
base: Drop obsolete/redundant `__GLASGOW_HASKELL__` checks

Since 527bcc41630918977c7 we require GHC >=7.6 for bootstrapping anyway.
This also allows to avoid the CPP-processing overhead for these two modules.

5 years agoRemove obsolete comment about (!!)
Joachim Breitner [Fri, 12 Sep 2014 21:13:07 +0000 (23:13 +0200)] 
Remove obsolete comment about (!!)

as spotted by David Feuer and reported as #9585.
The comment was right until ceb68b9118fa883e88abfaa532fc78f6640cf17f,
which is only 13 years ago :-).

5 years agoFix support for deriving Generic1 for data families (FIX #9563)
Jose Pedro Magalhaes [Fri, 12 Sep 2014 16:44:12 +0000 (17:44 +0100)] 
Fix support for deriving Generic1 for data families (FIX #9563)

5 years agoUpdate nofib submodule: Update gitignore with more generated files
Edward Z. Yang [Thu, 11 Sep 2014 14:40:27 +0000 (07:40 -0700)] 
Update nofib submodule: Update gitignore with more generated files

Signed-off-by: Edward Z. Yang <>
5 years agoMake GHC `time-1.5`-ready
Herbert Valerio Riedel [Wed, 10 Sep 2014 21:50:38 +0000 (23:50 +0200)] 
Make GHC `time-1.5`-ready

This also updates a few submodules to have their upper-bounds on
`time` relaxed to allow `time-1.5`. The only package that can't be
upgraded yet is `Cabal` due to API changes breaking `ghc-cabal`. This
needs to be addressed in a future commit.

5 years agoKill obsolete pre GHC 7.6 bootstrapping support
Herbert Valerio Riedel [Wed, 10 Sep 2014 21:46:03 +0000 (23:46 +0200)] 
Kill obsolete pre GHC 7.6 bootstrapping support

This left-over is definitely not needed anymore
and was probably missed in 527bcc41630918977c7

5 years agoT4801 perf numbers: Another typo
Joachim Breitner [Wed, 10 Sep 2014 14:18:17 +0000 (16:18 +0200)] 
T4801 perf numbers: Another typo

5 years agoFix T5321Fun perf number
Joachim Breitner [Wed, 10 Sep 2014 12:52:20 +0000 (14:52 +0200)] 
Fix T5321Fun perf number

(I obviously copy’n’pasted the wrong number.)

5 years agoUpdate performance numbers
Joachim Breitner [Wed, 10 Sep 2014 09:26:25 +0000 (11:26 +0200)] 
Update performance numbers

including some that are not failing yet, but did show a significant
change, and some that Austing changed post-AMP, but where both
harbormaster and ghcspeed reported something else. Numbers taken from
the ghcspeed machine.

5 years agotestsuite: AMPify T3001-2
Joachim Breitner [Wed, 10 Sep 2014 09:26:10 +0000 (11:26 +0200)] 
testsuite: AMPify T3001-2

5 years agotestsuite: AMPify ioprof.hs
Joachim Breitner [Wed, 10 Sep 2014 07:01:33 +0000 (09:01 +0200)] 
testsuite: AMPify ioprof.hs

5 years agoUpdate nofib submodule to track gc bitrot updates.
Edward Z. Yang [Wed, 10 Sep 2014 02:39:58 +0000 (19:39 -0700)] 
Update nofib submodule to track gc bitrot updates.

Signed-off-by: Edward Z. Yang <>
5 years agoUpdate nofib submodule to fix errors in main suite.
Edward Z. Yang [Tue, 9 Sep 2014 22:28:00 +0000 (15:28 -0700)] 
Update nofib submodule to fix errors in main suite.

Signed-off-by: Edward Z. Yang <>
5 years Stage1 needn't be built with -fllvm
Ben Gamari [Sat, 6 Sep 2014 17:24:30 +0000 (13:24 -0400)] Stage1 needn't be built with -fllvm

We can use the native codegen for stage 1 as it is to run on the host

Test Plan:



GHC Trac Issues:

5 years agobase: replace ver references by
Herbert Valerio Riedel [Tue, 9 Sep 2014 16:46:10 +0000 (18:46 +0200)] 
base: replace ver references by

Since we now had to major bump due to AMP being landed, `base-` is not
gonna happen, as we're going straight for a `base-` release.

[skip ci] since this is a doc-only change

5 years agoBump `base` version to for real
Herbert Valerio Riedel [Tue, 9 Sep 2014 15:39:57 +0000 (17:39 +0200)] 
Bump `base` version to for real

This commit updates several submodules in order to bump
the upper bounds on `base` of most boot packages

Moreover, this updates some of the test-suite cases which have
version numbers hardcoded within.

However, I'm not sure if this commit didn't introduce the following
two test-failures

   ghc-api  T8628 [bad stdout] (normal)
   ghc-api  T8639_api [bad stdout] (normal)

This needs investigation

5 years agoRevert "base: Bump version to"
Austin Seipp [Tue, 9 Sep 2014 13:51:04 +0000 (08:51 -0500)] 
Revert "base: Bump version to"

This reverts commit 0829f4c829a92d1287b820b12102a64dac91d35a.

This fails to build, because I'm dumb and hasty, obviously.

Signed-off-by: Austin Seipp <>
5 years agobase: Bump version to
Austin Seipp [Tue, 9 Sep 2014 13:18:56 +0000 (08:18 -0500)] 
base: Bump version to

Signed-off-by: Austin Seipp <>
5 years agoMake Applicative a superclass of Monad
Austin Seipp [Tue, 22 Apr 2014 11:09:40 +0000 (06:09 -0500)] 
Make Applicative a superclass of Monad

This includes pretty much all the changes needed to make `Applicative`
a superclass of `Monad` finally. There's mostly reshuffling in the
interests of avoid orphans and boot files, but luckily we can resolve
all of them, pretty much. The only catch was that
Alternative/MonadPlus also had to go into Prelude to avoid this.

As a result, we must update the hsc2hs and haddock submodules.

Signed-off-by: Austin Seipp <>
Test Plan: Build things, they might not explode horribly.

Reviewers: hvr, simonmar

Subscribers: simonmar

Differential Revision:

5 years agorules: fix buld failure due to o-boot suffix typo
Sergei Trofimovich [Mon, 8 Sep 2014 16:29:26 +0000 (19:29 +0300)] 
rules: fix buld failure due to o-boot suffix typo

Last-time tweak in commit 049bef7dc8858cff1b69002cde91b9d1cdef8e70
broke build. Update '_o-boot' to '_o-bootsuf' variable name.

Signed-off-by: Sergei Trofimovich <>
5 years agorules: cleanup: use '$way_*suf' var instead of open-coded '($3_way_)s'
Sergei Trofimovich [Mon, 8 Sep 2014 16:11:49 +0000 (19:11 +0300)] 
rules: cleanup: use '$way_*suf' var instead of open-coded '($3_way_)s'

The changes look like:
    -$1/$2/build/%.$$($3_way_)s : $1/%.c $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP)
    +$1/$2/build/%.$$($3_ssuf)  : $1/%.c $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP)

This way typos will manifest themselves in all ways,
not only non-vanilla.

Signed-off-by: Sergei Trofimovich <>
5 years agoTypos
Gabor Greif [Thu, 4 Sep 2014 21:00:06 +0000 (23:00 +0200)] 

5 years agoINLINE unfoldr
Joachim Breitner [Sat, 6 Sep 2014 20:21:54 +0000 (22:21 +0200)] 
INLINE unfoldr

to allow GHC to maybe remove the Maybe. See the code comment for more
commentary. This fixes #9369.

Test Plan: see what happens on ghcspeed (once it is merged)

Reviewers: austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

GHC Trac Issues: #9369

5 years agoUpdate T4801 perf numbers
Joachim Breitner [Sat, 6 Sep 2014 19:57:11 +0000 (21:57 +0200)] 
Update T4801 perf numbers

no individual cause indentified, but small improvements happened in
1719c42, 9d6fbcc, 949ad67 (or it is noise...)

5 years agoPostTcType replaced with TypeAnnot
Alan Zimmerman [Fri, 5 Sep 2014 23:11:04 +0000 (18:11 -0500)] 
PostTcType replaced with TypeAnnot

This is a first step toward allowing generic traversals of the AST without 'landmines', by removing the `panic`s located throughout `placeHolderType`, `placeHolderKind` & co.

See more on the discussion at

(This also makes a corresponding update to the `haddock` submodule.)

Test Plan: `sh validate` and new tests pass.

Reviewers: austin, simonpj, goldfire

Reviewed By: austin, simonpj, goldfire

Subscribers: edsko, Fuuzetsu, thomasw, holzensp, goldfire, simonmar, relrod, ezyang, carter

Projects: #ghc

Differential Revision:

5 years agoDo not use max_bytes_used for haddock test
Joachim Breitner [Sat, 6 Sep 2014 10:21:34 +0000 (12:21 +0200)] 
Do not use max_bytes_used for haddock test

Summary: as they are unreliable and hard to re-run.

Test Plan: Run the testsuite

Reviewers: austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

GHC Trac Issues: #9556

5 years agoRevert "Do not test max_bytes_used et. al for haddock tests"
Joachim Breitner [Fri, 5 Sep 2014 21:03:58 +0000 (23:03 +0200)] 
Revert "Do not test max_bytes_used et. al for haddock tests"

This reverts commit 498d7dd2dc731a92eda2210e4ab0a04366511627. Again
sorry for the noise. This is the last reverstion. I will fix this for
good at around 12:13 CEST tomorrow :-)

5 years agopprC: declare extern cmm primitives as functions, not data
Sergei Trofimovich [Thu, 4 Sep 2014 14:50:45 +0000 (17:50 +0300)] 
pprC: declare extern cmm primitives as functions, not data

  The commit fixes incorrect code generation of
  integer-gmp package on ia64 due to C prototypes mismatch.
  Before the patch prototypes for "foreign import prim" were:
      StgWord poizh[];
  After the patch they became:
      StgFunPtr poizh();

Long story:

Consider the following simple example:

    {-# LANGUAGE MagicHash, GHCForeignImportPrim, UnliftedFFITypes #-}
    module M where
    import GHC.Prim -- Int#
    foreign import prim "poizh" poi# :: Int# -> Int#

Before the patch unregisterised build generated the
following 'poizh' reference:
    EI_(poizh); /* StgWord poizh[]; */
    FN_(M_poizh_entry) {
    // ...

After the patch it looks this way:
    EF_(poizh); /* StgFunPtr poizh(); */
    FN_(M_poizh_entry) {
    // ...

On ia64 it leads to different relocation types being generated:
  incorrect one:
    addl r14 = @ltoffx(poizh#) r14 = [r14], poizh# ; r14 = address-of 'poizh#'
  correct one:
    addl r14 = @ltoff(@fptr(poizh#)), gp ; r14 = address-of-thunk 'poizh#'
    ld8 r14 = [r14]

'@fptr(poizh#)' basically instructs assembler to creates
another obect consisting of real address to 'poizh' instructions
and module address. That '@fptr' object is used as a function "address"
This object is different for every module referencing 'poizh' symbol.

All indirect function calls expect '@fptr' object. That way
call site reads real destination address and set destination
module address in 'gp' register from '@fptr'.

Signed-off-by: Sergei Trofimovich <>
5 years agoAdd missing changelog/since entry for `uncons`
Herbert Valerio Riedel [Thu, 4 Sep 2014 10:42:54 +0000 (12:42 +0200)] 
Add missing changelog/since entry for `uncons`

This is a follow-up commit to
e428b5b8cc1448dcff7d7cdcbeb738eb0bea102f (refs D195 & #9550)

5 years agoSmall improvement to unsaturated-type-function error message
Simon Peyton Jones [Wed, 3 Sep 2014 20:47:43 +0000 (21:47 +0100)] 
Small improvement to unsaturated-type-function error message

5 years agoAnother test for type function saturation
Simon Peyton Jones [Wed, 3 Sep 2014 20:44:40 +0000 (21:44 +0100)] 
Another test for type function saturation

Came up on GHC users list

5 years agoUpdate performance numbers (mostly improved)
Simon Peyton Jones [Wed, 3 Sep 2014 20:40:59 +0000 (21:40 +0100)] 
Update performance numbers (mostly improved)

5 years agoDo not test max_bytes_used et. al for haddock tests
Joachim Breitner [Thu, 4 Sep 2014 08:52:32 +0000 (10:52 +0200)] 
Do not test max_bytes_used et. al for haddock tests

Summary: as these are unreliable, and it is hard to re-run haddock with other RTS flags.

Test Plan: run validate

Reviewers: austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

GHC Trac Issues: #9551

5 years agoRevert "Remove max_bytes_used test from haddock test cases"
Joachim Breitner [Thu, 4 Sep 2014 08:33:51 +0000 (10:33 +0200)] 
Revert "Remove max_bytes_used test from haddock test cases"

This reverts commit 8c427ebe9c34b9bcecd41fb0584d24989c00ffe6.

Sorry for the noise, but I need to practice my HIW talk, which will
involve some live development...

5 years agoAdd Data.List.uncons
David Feuer [Thu, 4 Sep 2014 06:04:12 +0000 (08:04 +0200)] 
Add Data.List.uncons

As discussed in and
submitted at #9550.

Test Plan: Submit to phab, see what happens.

Reviewers: austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

GHC Trac Issues: #9550

5 years agoUpdate nofib submodule: Hide Word from Prelude
Joachim Breitner [Tue, 2 Sep 2014 15:55:16 +0000 (17:55 +0200)] 
Update nofib submodule: Hide Word from Prelude

in benchmarks where Word is used. This fixes fall-out from #9531.

5 years cleanup: remove unused 'HaveLibDL' subst
Sergei Trofimovich [Mon, 1 Sep 2014 15:52:17 +0000 (18:52 +0300)] cleanup: remove unused 'HaveLibDL' subst

Signed-off-by: Sergei Trofimovich <>
5 years agorts/Printer.c: update comments about using USING_LIBBFD
Sergei Trofimovich [Mon, 1 Sep 2014 15:09:56 +0000 (18:09 +0300)] 
rts/Printer.c: update comments about using USING_LIBBFD

Signed-off-by: Sergei Trofimovich <>
5 years agoRemove max_bytes_used test from haddock test cases
Joachim Breitner [Tue, 2 Sep 2014 09:49:49 +0000 (11:49 +0200)] 
Remove max_bytes_used test from haddock test cases

as these are not very reliable, and the advice to make them reliable
is hard to apply to them.

(This is just my practicing phab...)

Test Plan: validate

Reviewers: austin

Reviewed By: austin

Subscribers: carter, ezyang, simonmar

Differential Revision:

GHC Trac Issues: #9535

5 years agoRevert "Fix a couple test failures encountered when building on Windows"
Austin Seipp [Mon, 1 Sep 2014 22:26:47 +0000 (17:26 -0500)] 
Revert "Fix a couple test failures encountered when building on Windows"

This reverts commit 9711f78f790d10d914e08851544c6fc96f9a030a, as it's
causing build phailures in phabricator.

5 years agosystools: fix gcc version detecton on non-english locale
Sergei Trofimovich [Mon, 1 Sep 2014 21:06:56 +0000 (00:06 +0300)] 
systools: fix gcc version detecton on non-english locale

ghc runs 'gcc -v' to check if we run under vanilla gcc
or disaguised clang by checking for string

    "gcc version <something>"

But this check does not always work as gcc has that string
localized via gettext mechanism:

    (some gcc's locale strings)
    be.po-msgstr "версія gcc %s\n"
    da.po-msgstr "GCC version %s\n"
    de.po-msgstr "gcc-Version %s %s\n"
    el.po-msgstr "έκδοση gcc %s\n"

To ping gcc to English locale we now override environment
variable with 'LANGUAGE=en' value.

Fixes Issue #8825

Signed-off-by: Sergei Trofimovich <>
Test Plan: validate

Reviewers: austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

GHC Trac Issues: #8825

5 years agoFix a couple test failures encountered when building on Windows
Austin Seipp [Mon, 1 Sep 2014 20:14:18 +0000 (15:14 -0500)] 
Fix a couple test failures encountered when building on Windows

* Adjusts performance tests
* Change ghcpkg05.stderr-mingw32 to match ghcpkg05.stderr

Test Plan: Ran 'sh validate' and observed fewer test failures afterwards

Reviewers: austin

Reviewed By: austin

Differential Revision:

5 years agoSet llc and opt commands on all platforms
Austin Seipp [Mon, 1 Sep 2014 20:14:07 +0000 (15:14 -0500)] 
Set llc and opt commands on all platforms

LLVM llc and opt commands should be set on all platforms, including
Windows. If they're not, GHC tries to execute an unnamed executable,
resulting in error messages such as:

    Error (figuring out LLVM version): : runInteractiveProcess: invalid argument (Invalid argument)
    <no location info>:
        Warning: Couldn't figure out LLVM version!
                 Make sure you have installed LLVM

This regression was introduced in e6bfc596.

Test Plan: Build GHC and test if --info shows sensible values of "LLVM llc command" and "LLVM opt command"

Reviewers: austin, #ghc

Reviewed By: austin, #ghc

Subscribers: austin

Projects: #ghc

Differential Revision:

GHC Trac Issues: #7143

5 years agoRefactor stack squeezing logic
Arash Rouhani [Mon, 1 Sep 2014 20:13:57 +0000 (15:13 -0500)] 
Refactor stack squeezing logic

This patch is only to make the code easier to read.

In addition, this is the first patch I send with the arc/differential workflow.
So I start with something very small.

Test Plan: I have not even tried to compile it yet.

Reviewers: simonmar, austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

5 years agogenprimopcode: GHC.Prim is Unsafe (#9449)
Austin Seipp [Mon, 1 Sep 2014 20:13:44 +0000 (15:13 -0500)] 
genprimopcode: GHC.Prim is Unsafe (#9449)

Make sure the documentation for `GHC.Prim` adequately
reflects the fact it is unsafe.

Also clean up some 80-column violations.

Signed-off-by: Austin Seipp <>
Test Plan:
Build documentation, check `GHC.Prim`. It's properly marked
as `Unsafe`.

Reviewers: hvr, goldfire, ezyang

Reviewed By: ezyang

Subscribers: nomeata, simonmar, ezyang, carter

Differential Revision:

GHC Trac Issues: #9449

5 years agoMake Lexer.x more like the 2010 report
Thomas Miedema [Mon, 1 Sep 2014 20:13:00 +0000 (15:13 -0500)] 
Make Lexer.x more like the 2010 report

I tried reading the lexer and the 2010 report side-by-side. Althought I didn't
quite finish, here are some small discrepancies that I found.

This revision may be low priority for reviewers, but having these commits just
in my local repository does no good either.

* $nl was defined, but not used anywhere
* formfeed is a newline character
* add \: to $ascsymbol
  For simplification reason, the colon (':') was added to the character
  set $ascsymbol in the 2010 report. Here we make the same change.
* introduce the macros `qvarid`, `qconid`, `qvarsym` and `qconsym`
* foreign is a Haskell keyword
* add/update comments

Test Plan: Harbormaster (is awesome)

Reviewers: simonmar, hvr, austin

Reviewed By: austin

Subscribers: hvr, simonmar, ezyang, carter

Differential Revision:

5 years agoCleanup and better documentation of sync-all script
Thomas Miedema [Mon, 1 Sep 2014 20:12:32 +0000 (15:12 -0500)] 
Cleanup and better documentation of sync-all script

Rumor has it that sync-all is slowly on the way out. Now that all
subrepositories have been turned into git submodules, sync-all might
not be needed anymore. Nevertheless, here are some changes I had made
while trying to understand why it existed in the first place:

* update comments + help text
* rename some variables for maintainability
    * s/branch_name/remote_name/
    origin is the name of a remote, not a branch

    * s/repo_base/remote_root/
    the word *remote* is key here

    * s/defaultrepo/default_root/
    this was a darcsism, and it doesn't refer to a repository but to the
    root directory of all repositories
* small tweaks
* .git can be a file nowadays
* don't skip END actions on exceptions #8886
  reverts d523f9b3d4ce3463e8816cad2139ea397e00f8d1

Test Plan:
Why revert d523f9b3d4ce3463e8816cad2139ea397e00f8d1?

I put an old haddock repository from back in my tree. Now, when running
`sync-all get`, the following happens:

1. I get a cryptic error saying:

    fatal: reference is not a tree:
    Unable to checkout '5412c262f403e52be45d607b34eb3a5806ea2a76' in
    submodule path 'utils/haddock'
    git failed: 256 at ./sync-all line 112.

2. sync-all checks if maybe an old haddock repository is present

3. I get a clear warning saying:


    You have an old haddock repository in your GHC tree!

    Please remove it (e.g. "rm -r utils/haddock"), and then run
    "./sync-all get" to get the new repository.

Without commit d523f9b3d4ce3463e8816cad2139ea397e00f8d1 reverted, steps
2 and 3 were skipped. The problem that commit tried to solve,
is now solved with 7012ed8515100b4947383e93b82dbff7a0aa835c.

Reviewers: nomeata, austin, hvr

Reviewed By: austin, hvr

Subscribers: simonmar, ezyang, carter

Differential Revision:

GHC Trac Issues: #8886, #9212

5 years agoStringBuffer should not contain initial byte-order mark (BOM)
Thomas Miedema [Mon, 1 Sep 2014 20:11:50 +0000 (15:11 -0500)] 
StringBuffer should not contain initial byte-order mark (BOM)

Just skipping over a BOM, but leaving it in the Stringbuffer, is not
sufficient. The Lexer calls prevChar when a regular expression starts
with '^' (which is a shorthand for '\n^'). It would never match on the
first line, since instead of '\n', prevChar would still return '\xfeff'.

Test Plan: validate

Reviewers: austin, ezyang

Reviewed By: austin, ezyang

Subscribers: simonmar, ezyang, carter

Differential Revision:

GHC Trac Issues: #6016

5 years agoincludes/Stg.h: remove unused 'wcStore' inline
Sergei Trofimovich [Mon, 1 Sep 2014 18:15:21 +0000 (21:15 +0300)] 
includes/Stg.h: remove unused 'wcStore' inline

Commit reverts never used addition in cbd29e0a23bb8e15033edae123d6c8fbe9740c97

I think it might make sense to take advantage of TSO/RMO/PSO models
tome day. But it's highly architecture/model-dependent thus it better
be implemented in per-arch Native CodeGen.

Signed-off-by: Sergei Trofimovich <>
Test Plan: build-tested on UNREG-amd64

Reviewers: simonmar, austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

5 years agotestsuite: update T6056 rule firing order
Sergei Trofimovich [Mon, 1 Sep 2014 18:13:45 +0000 (21:13 +0300)] 
testsuite: update T6056 rule firing order

Fixes testsuite failure.

Summary: Signed-off-by: Sergei Trofimovich <>

Test Plan: validate --slow

Reviewers: simonpj, austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

5 years agoMake ghc-api cleaning less aggressive.
Edward Z. Yang [Mon, 1 Sep 2014 09:16:15 +0000 (11:16 +0200)] 
Make ghc-api cleaning less aggressive.

Signed-off-by: Edward Z. Yang <>
5 years agoRemove incorrect property in docstring (re #9532)
Herbert Valerio Riedel [Mon, 1 Sep 2014 07:50:16 +0000 (09:50 +0200)] 
Remove incorrect property in docstring (re #9532)

The property

  countLeadingZeros . negate = const 0

doesn't generally hold and it's not such a useful property to state, as
it simply follows from "sign-bit == most-significant-bit" for FiniteBits
types which use twos-complement representation for negative values, and
even then it breaks down for 0...

TLDR, remove thinko from documentation of `countLeadingZeros`

5 years ago`M-x delete-trailing-whitespace` & `M-x untabify`...
Herbert Valerio Riedel [Sun, 31 Aug 2014 14:05:26 +0000 (16:05 +0200)] 
`M-x delete-trailing-whitespace` & `M-x untabify`...

...some files more or less recently touched by me

[ci skip]

5 years agoAdd `FiniteBits(count{Leading,Trailing}Zeros)`
Herbert Valerio Riedel [Thu, 14 Aug 2014 10:32:32 +0000 (12:32 +0200)] 
Add `FiniteBits(count{Leading,Trailing}Zeros)`

This exposes the newly added CLZ/CTZ primops from
e0c1767d0ea8d12e0a4badf43682a08784e379c6 (re #9340)
via two new methods `countLeadingZeros` and `countTrailingZeros`
in the `Data.Bits.FiniteBits` class.

The original proposal can be found at

Test Plan: successful validate

Reviewers: ekmett, tibbe

GHC Trac Issues: #9532

Differential Revision:

5 years agoRe-export Word from Prelude (re #9531)
Herbert Valerio Riedel [Sun, 31 Aug 2014 09:40:50 +0000 (11:40 +0200)] 
Re-export Word from Prelude (re #9531)

The original proposal text can be found at

The proposal passed with a clear majority, and was additionally
confirmed by the core libraries committee.

*Compatibility Note*

Only code that imports `Data.Word` for the sole purpose of using `Word`
*and* requires to be `-Werror`-clean (due to `-fwarn-unused-imports`)
is affected by this change.

In order to write warning-free forward/backward compatible against `base`,
a variant of the following CPP-based snippet can be used:

  -- Starting with base>4.7.0 or GHC>7.8 Prelude re-exports 'Word'
  -- The following is needed, if 'Word' is the *only* entity needed from Data.Word
  #ifdef MIN_VERSION_base
  # if !MIN_VERSION_base(4,7,1)
  import Data.Word (Word)
  # endif
  -- no cabal_macros.h -- fallback to __GLASGOW_HASKELL__
  #elif __GLASGOW_HASKELL__ < 709
  import Data.Word (Word)

This also updates the haddock submodule in order to avoid a compile warning

5 years agoRevert "Make sure that a prototype is included for 'setIOManagerControlFd'"
Gabor Greif [Fri, 29 Aug 2014 22:30:39 +0000 (00:30 +0200)] 
Revert "Make sure that a prototype is included for 'setIOManagerControlFd'"

This reverts commit 7bf49f86a20f3beda0ee5fbea2db64cfef730d74.

5 years agoRevert "Comment why the include is necessary"
Gabor Greif [Fri, 29 Aug 2014 22:30:07 +0000 (00:30 +0200)] 
Revert "Comment why the include is necessary"

This reverts commit 15df6d98afb8c3813013c5b97efffe0ba8020d32.

5 years agoSome typos
Gabor Greif [Fri, 29 Aug 2014 21:51:20 +0000 (23:51 +0200)] 
Some typos

5 years agotestsuite: normalise integer library name for T8958
Sergei Trofimovich [Fri, 29 Aug 2014 16:06:14 +0000 (19:06 +0300)] 
testsuite: normalise integer library name for T8958

Signed-off-by: Sergei Trofimovich <>
5 years agoFix to bin-package-db for ming32-only code
Simon Peyton Jones [Fri, 29 Aug 2014 21:06:56 +0000 (22:06 +0100)] 
Fix to bin-package-db for ming32-only code

Patch written by Pali Gabor Janos <>

5 years agoTypos in comments
Gabor Greif [Fri, 29 Aug 2014 16:49:01 +0000 (18:49 +0200)] 
Typos in comments

5 years agoDo not say we cannot when we clearly can
Gabor Greif [Thu, 28 Aug 2014 17:14:39 +0000 (19:14 +0200)] 
Do not say we cannot when we clearly can

5 years agoPerformance improvement of the compiler itself
Simon Peyton Jones [Fri, 29 Aug 2014 16:16:36 +0000 (17:16 +0100)] 
Performance improvement of the compiler itself

This is a result of one of these, or a combination
  002b7a2b * Give the worker for an INLINABLE function a suitably-phased Activation
  ca666b8b * When finding loop breakers, distinguish INLINE from INLINEABLE
  a98c9c5e * Fix a bug in CSE, for INLINE/INLNEABLE things

Some changes are quite big: for bytes_allocated we have
  T6048: 13% below expected
  T5837: 15% below expected
  T3064:  5% below expected

Of course, these might have already been close to their lower
threshold, so perhaps not all the improvement is from here.
But it is good news all the same.

5 years agoFinally! Test Trac #6056
Simon Peyton Jones [Fri, 29 Aug 2014 14:37:16 +0000 (15:37 +0100)] 
Finally!  Test Trac #6056

5 years agoGive the worker for an INLINABLE function a suitably-phased Activation
Simon Peyton Jones [Fri, 29 Aug 2014 14:34:19 +0000 (15:34 +0100)] 
Give the worker for an INLINABLE function a suitably-phased Activation

See Note [Activation for INLINABLE worker].  This was preventing
Trac #6056 from working.

5 years agoBetter specImport discarding message (again)
Simon Peyton Jones [Fri, 29 Aug 2014 14:28:15 +0000 (15:28 +0100)] 
Better specImport discarding message (again)

5 years agoWhen finding loop breakers, distinguish INLINE from INLINEABLE
Simon Peyton Jones [Fri, 29 Aug 2014 14:18:08 +0000 (15:18 +0100)] 
When finding loop breakers, distinguish INLINE from INLINEABLE

Previously INLINE and INLINEABLE were treated identically, but it's
crucial that we don't choose a wrapper (INLINE) as a loop breaker,
when it is mutually recursive with an INLINEABLE worker.

5 years agoComments, white space, and rename "InlineRule" to "stable unfolding"
Simon Peyton Jones [Fri, 29 Aug 2014 14:16:16 +0000 (15:16 +0100)] 
Comments, white space, and rename "InlineRule" to "stable unfolding"

The "InlineRule" is gone now, so this is just making the comments line
up with the code.  A function does change its name though:
   updModeForInlineRules  -->  updModeForStableUnfoldings

5 years agoFix a bug in CSE, for INLINE/INLNEABLE things
Simon Peyton Jones [Fri, 29 Aug 2014 14:11:19 +0000 (15:11 +0100)] 
Fix a bug in CSE, for INLINE/INLNEABLE things

Previusly we simply weren't doing CSE at all on things
whose unfolding were not always-active, for reasons explained
in Note [CSE for INLINE and NOINLINE].  But that was bad!
Making something INLNEABLE meant that its RHS was no longer
CSE'd, and that made some nofib programs worse.

And it's entirely unnecessary.  I thoguht it through again,
wrote new comments (under the same Note), and things are
better again.

5 years agoInclude pattern synonyms as AConLikes in the type environment,
Dr. ERDI Gergo [Fri, 29 Aug 2014 13:15:22 +0000 (21:15 +0800)] 
Include pattern synonyms as AConLikes in the type environment,
even for simplified/boot ModDetails (fixes #9417)

5 years agoSuppress binary warnings for bootstrapping as well as stage1.
Edward Z. Yang [Fri, 29 Aug 2014 14:55:59 +0000 (15:55 +0100)] 
Suppress binary warnings for bootstrapping as well as stage1.

This was missed when we added binary to the list of boot packages.
But note: the warnings binary are *legitimate* and really should be fixed!

Signed-off-by: Edward Z. Yang <>
5 years agoFix failing test on BINDIST=YES
Edward Z. Yang [Fri, 29 Aug 2014 12:35:09 +0000 (13:35 +0100)] 
Fix failing test on BINDIST=YES

Signed-off-by: Edward Z. Yang <>
5 years agoAdd release notes about ghc-pkg change, and Cabal dep removal
Duncan Coutts [Thu, 28 Aug 2014 04:52:48 +0000 (05:52 +0100)] 
Add release notes about ghc-pkg change, and Cabal dep removal

That ghc-pkg doesn't support single-file style databases, and that
the ghc library does not depend on Cabal any more.

We don't need to document the ghc-pkg change in the ghc-pkg section
itself, since ghc-pkg init is already described there, and that is the
right thing. The old deprecated approach was not documented.

5 years agoFix a few minor issues spotted in code review
Duncan Coutts [Thu, 28 Aug 2014 04:24:04 +0000 (05:24 +0100)] 
Fix a few minor issues spotted in code review

5 years agoChange testsuite to not use old-style file package databases
Duncan Coutts [Wed, 27 Aug 2014 15:33:20 +0000 (16:33 +0100)] 
Change testsuite to not use old-style file package databases

Now uses ghc-pkg init. The file-style databases are no longer supported.

5 years agoUpdate Cabal and haddock submodules to follow the Canal-dep removal changes
Duncan Coutts [Wed, 27 Aug 2014 12:57:46 +0000 (13:57 +0100)] 
Update Cabal and haddock submodules to follow the Canal-dep removal changes

In particular, Cabal was still in one place using old file-style package
databases. Haddock just needed simple changes to follow the change of
representation of packages in the ghc library.

5 years agoFix validation error in Linker arising from package rep changes
Duncan Coutts [Wed, 27 Aug 2014 12:26:24 +0000 (13:26 +0100)] 
Fix validation error in Linker arising from package rep changes

5 years agoAddress a number of Edward's code review comments
Duncan Coutts [Sun, 24 Aug 2014 22:43:40 +0000 (23:43 +0100)] 
Address a number of Edward's code review comments

Some others addressed as part of other recent patches.

5 years agoFix string conversions in ghc-pkg to be correct w.r.t. Unicode
Duncan Coutts [Sun, 24 Aug 2014 21:11:33 +0000 (22:11 +0100)] 
Fix string conversions in ghc-pkg to be correct w.r.t. Unicode

Similar change to that on the ghc library side in the previous patch.
The BinaryStringRep class has to use a ByteString in UTF8 encoding.

5 years agoSwitch the package id types to use FastString (rather than String)
Duncan Coutts [Sun, 24 Aug 2014 20:59:03 +0000 (21:59 +0100)] 
Switch the package id types to use FastString (rather than String)

The conversions should now be correct w.r.t Unicode.

Also move a couple instances to avoid orphan instances.

Strictly speaking there's no need for these types to use FastString as
they do not need the unique feature. They could just use some other
compact string type, but ghc's internal utils don't have much support
for such a type, so we just use FastString.