ghc.git
23 months agodon't allow AsmTempLabel in UNREG mode (Trac #14264)
Sergei Trofimovich [Sun, 24 Sep 2017 11:14:03 +0000 (12:14 +0100)] 
don't allow AsmTempLabel in UNREG mode (Trac #14264)

AsmTempLabel is really a label that describes
label in assembly output (or equivalent like LLVM IR).

Unregisterised build does not handle it correctly.

This change does not fix UNREG build failure in
Ticket #14264 but reverts back to panic:
    pprCLbl AsmTempLabel

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
23 months agoRevert "Typeable: Allow App to match arrow types"
Herbert Valerio Riedel [Sun, 24 Sep 2017 06:54:28 +0000 (08:54 +0200)] 
Revert "Typeable: Allow App to match arrow types"

This reverts commit cc6be3a2f23c9b2e04f9f491099149e1e1d4d20b.
because it caused the regression #14270 which according to
Richard probably doesn't have an easy fix. So this one goes
back to the drawning board.

This reopens #14236

23 months ago[Semigroup] fix genapply
Moritz Angermann [Sat, 23 Sep 2017 13:21:45 +0000 (21:21 +0800)] 
[Semigroup] fix genapply

Summary:
The SMP causes <> to be exported from Prelude by
default.  When building HEAD with HEAD, genapply suffers from
<> being imported from Prelude.

Reviewers: hvr, bgamari, austin

Reviewed By: hvr

Subscribers: rwbarton, thomie

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

23 months agoFix AsmTempLabel
Moritz Angermann [Fri, 22 Sep 2017 08:17:30 +0000 (16:17 +0800)] 
Fix AsmTempLabel

Summary:
This is another fallout from 8b007abb
should fix Trac #14264. I am not sure if this is
complete. It does however allow me to build an iOS
LLVM cross compiler.

Reviewers: bgamari, trofi, austin, simonmar

Reviewed By: trofi

Subscribers: rwbarton, thomie

GHC Trac Issues: #14264

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

23 months agoAdditional LLVM_TARGET logic.
Moritz Angermann [Thu, 21 Sep 2017 13:28:29 +0000 (21:28 +0800)] 
Additional LLVM_TARGET logic.

Summary:
This should help resolve the
compilcation that came up in Trac #14261

Test Plan: validate on various platforms

Reviewers: trofi, bgamari, austin, hvr

Reviewed By: trofi

Subscribers: rwbarton, thomie, erikd

GHC Trac Issues: #14261

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

23 months agoBump haskeline submodule
Ben Gamari [Fri, 22 Sep 2017 20:55:54 +0000 (16:55 -0400)] 
Bump haskeline submodule

Should fix the win32 build.

23 months agoFix build with GhcWithInterpreter=NO
Herbert Valerio Riedel [Fri, 22 Sep 2017 11:03:49 +0000 (13:03 +0200)] 
Fix build with GhcWithInterpreter=NO

This is a consequence of NoImplicitPrelude which was introduced
in f63bc730c7ea42ca6882f8078eb86be8bf1cc6ad.

23 months agoRemove 'stm' from EXTRA_PACKAGES set
Herbert Valerio Riedel [Fri, 22 Sep 2017 08:35:02 +0000 (10:35 +0200)] 
Remove 'stm' from EXTRA_PACKAGES set

This effectively broke `make sdist`; the surprising thing is that
./validate didn't catch this (and thus the buildbots didn't either).

Also, I would have expected `EXTRA_PACKAGES` to be populated by the
data in `./packages` which already encodes that information...

This is a follow-up to 02ff70563e490d2a7f3141eab7229803c523da57

23 months agoFix broken LLVM code gen
Moritz Angermann [Thu, 21 Sep 2017 22:05:46 +0000 (18:05 -0400)] 
Fix broken LLVM code gen

In 8b007abbeb30 (nativeGen: Consistently use blockLbl to generate
CLabels from BlockIds) all blockLbls were changed. This interfered with
the `toInfoLbl` call in CmmProcPoint, and caused the LLVM backend to
fall over.

Reviewers: bgamari, austin, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

23 months agoImplement TH addCorePlugin.
Facundo Domínguez [Thu, 21 Sep 2017 22:04:56 +0000 (18:04 -0400)] 
Implement TH addCorePlugin.

This allows template-haskell code to add plugins to the compilation
pipeline. Otherwise, the user would have to pass -fplugin=... to ghc.

For now, plugin modules in the current package can't be used. This is
because when TH runs, it is too late to let GHC know that the plugin
modules needed to be compiled first.

Test Plan: ./validate

Reviewers: simonpj, bgamari, austin, goldfire

Reviewed By: bgamari

Subscribers: angerman, rwbarton, mboes, thomie

GHC Trac Issues: #13608

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

23 months agorts: Set unwind information for catch_frame
Ben Gamari [Thu, 21 Sep 2017 22:04:24 +0000 (18:04 -0400)] 
rts: Set unwind information for catch_frame

Reviewers: austin, erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie

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

23 months agorts: Set unwind information for remaining stack frames
Ben Gamari [Thu, 21 Sep 2017 22:04:03 +0000 (18:04 -0400)] 
rts: Set unwind information for remaining stack frames

Reviewers: austin, erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie

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

23 months agoReexport Semigroup's <> operator from Prelude (#14191)
Herbert Valerio Riedel [Thu, 21 Sep 2017 21:30:05 +0000 (23:30 +0200)] 
Reexport Semigroup's <> operator from Prelude (#14191)

This completes the 2nd phase of the Semigroup=>Monoid Proposal (SMP)
initiated in 8ae263ceb3566a7c82336400b09cb8f381217405.

This updates a couple submodules to address <> naming clashes.

23 months agocmm/CBE: Use foldLocalRegsDefd
Ben Gamari [Thu, 21 Sep 2017 22:02:36 +0000 (18:02 -0400)] 
cmm/CBE: Use foldLocalRegsDefd

Simonpj suggested this as a follow-on to #14226 to avoid code
duplication. This also gives us the ability to CBE cases involving
foreign calls for free.

Test Plan: Validate

Reviewers: austin, simonmar, simonpj

Reviewed By: simonpj

Subscribers: michalt, simonpj, rwbarton, thomie

GHC Trac Issues: #14226

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

23 months agotestsuite: Bump allocations of T12150
Ben Gamari [Thu, 21 Sep 2017 21:23:34 +0000 (17:23 -0400)] 
testsuite: Bump allocations of T12150

It looks like this is probably just drift.

23 months agoAlso show types that subsume a hole as valid substitutions for that hole.
Matthías Páll Gissurarson [Thu, 21 Sep 2017 18:14:53 +0000 (14:14 -0400)] 
Also show types that subsume a hole as valid substitutions for that hole.

This builds on the previous "Valid substitutions include..." functionality,
but add subsumption checking as well, so that the suggested valid substitutions
show not only exact matches, but also identifiers that fit the hole by virtue of
subsuming the type of the hole (i.e. being more general than the type of the
hole).

Building on the previous example, in the given program

```
ps :: String -> IO ()
ps = putStrLn

ps2 :: a -> IO ()
ps2 _ = putStrLn "hello, world"

main :: IO ()
main = _ "hello, world"
```

The results would be something like

```
    • Found hole: _ :: [Char] -> IO ()
    • In the expression: _
      In the expression: _ "hello, world"
      In an equation for ‘main’: main = _ "hello, world"
    • Relevant bindings include main :: IO () (bound at t1.hs:8:1)
      Valid substitutions include
        ps :: String -> IO () (defined at t1.hs:2:1)
        ps2 :: forall a. a -> IO () (defined at t1.hs:5:1)
        putStrLn :: String -> IO ()
          (imported from ‘Prelude’ at t1.hs:1:1
           (and originally defined in ‘System.IO’))
        fail :: forall (m :: * -> *). Monad m => forall a. String -> m a
          (imported from ‘Prelude’ at t1.hs:1:1
           (and originally defined in ‘GHC.Base’))
        mempty :: forall a. Monoid a => a
          (imported from ‘Prelude’ at t1.hs:1:1
           (and originally defined in ‘GHC.Base’))
        print :: forall a. Show a => a -> IO ()
          (imported from ‘Prelude’ at t1.hs:1:1
           (and originally defined in ‘System.IO’))
        (Some substitutions suppressed;
         use -fmax-valid-substitutions=N or -fno-max-valid-substitutions)
```

Signed-off-by: Matthías Páll Gissurarson <mpg@mpg.is>
Modified according to suggestions from Simon PJ

Accept tests that match the expectations, still a few to look better at

Swithced to using tcLookup, after sit down with SPJ at ICFP. Implications are WIP.

Now works with polymorphism and constraints!

We still need to merge the latest master, before we can make a patch.

Wrap the type of the hole, instead of implication shenanigans,

As per SPJs suggestion, this is simpler and feels closer to
what we actually want to do.

Updated tests with the new implementation

Remove debugging trace and update documentation

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: RyanGlScott, rwbarton, thomie

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

23 months agoBump base to 4.11.0.0
Ben Gamari [Thu, 21 Sep 2017 16:50:47 +0000 (12:50 -0400)] 
Bump base to 4.11.0.0

Bumps numerous submodules.

Reviewers: austin, hvr

Subscribers: rwbarton, thomie

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

23 months agobase: Add changelog entry for withTypeable generalization
Ben Gamari [Thu, 21 Sep 2017 16:11:33 +0000 (12:11 -0400)] 
base: Add changelog entry for withTypeable generalization

23 months agotestsuite: Add unboxed sum to T13929
Ben Gamari [Tue, 19 Sep 2017 23:09:58 +0000 (19:09 -0400)] 
testsuite: Add unboxed sum to T13929

Test Plan: Validate

Reviewers: austin

Subscribers: rwbarton, thomie

GHC Trac Issues: #13929

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

23 months agotestsuite: Add testcase for #14253
Ben Gamari [Tue, 19 Sep 2017 23:03:33 +0000 (19:03 -0400)] 
testsuite: Add testcase for #14253

Reviewers: austin

Subscribers: rwbarton, thomie

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

23 months agoIdentify fields by selector when type-checking (fixes #13644)
Adam Gundry [Tue, 19 Sep 2017 23:03:16 +0000 (19:03 -0400)] 
Identify fields by selector when type-checking (fixes #13644)

Test Plan: new test for #13847, and the test for #13644 now passes

Reviewers: mpickering, austin, bgamari, simonpj

Reviewed By: mpickering, simonpj

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #13644, #13847

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

23 months agoTypeable: Generalize kind of represented type
Ben Gamari [Tue, 19 Sep 2017 22:59:18 +0000 (18:59 -0400)] 
Typeable: Generalize kind of represented type

This allows withTypeable to be used with things that are of kind other
than Type.

Test Plan: Validate

Reviewers: austin, hvr, dfeuer

Reviewed By: dfeuer

Subscribers: rwbarton, thomie, dfeuer

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

23 months agoTypeable: Allow App to match arrow types
Ben Gamari [Tue, 19 Sep 2017 22:57:38 +0000 (18:57 -0400)] 
Typeable: Allow App to match arrow types

Test Plan: T14236

Reviewers: austin, hvr, goldfire

Reviewed By: goldfire

Subscribers: RyanGlScott, simonpj, rwbarton, goldfire, thomie, dfeuer

GHC Trac Issues: #14236

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

23 months agoInitial CircleCI support.
Mathieu Boespflug [Sun, 3 Sep 2017 14:13:06 +0000 (16:13 +0200)] 
Initial CircleCI support.

23 months agoTypofixes (visiblity -> visibility)
Ryan Scott [Thu, 21 Sep 2017 13:08:15 +0000 (09:08 -0400)] 
Typofixes (visiblity -> visibility)

23 months agoaclocal.m4: call cygpath on mingw32 only
Sergei Trofimovich [Wed, 20 Sep 2017 22:18:22 +0000 (23:18 +0100)] 
aclocal.m4: call cygpath on mingw32 only

The only reason I noticed is warning these lines on linux:

```
$ ./configure --target=sparc-unknown-linux-gnu
...
./configure: line 9708: cygpath: command not found
./configure: line 9708: ArCmd: command not found
```

POSIX shell syntax requires no spaces in assignments.
Fixed guarding condition while at it.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
23 months agoAdd 'stm' package to the global package database
Herbert Valerio Riedel [Wed, 20 Sep 2017 13:16:24 +0000 (15:16 +0200)] 
Add 'stm' package to the global package database

This is a preparation for `haskeline` picking up a dependency on `stm`
real soon now. See https://github.com/judah/haskeline/pull/61 for details.

If we figure out a way to not bundle the libraries depended upon by the
GHCi executable in the global package database (see #8919 for the original
reason why we had to start bundling terminfo/haskeline in the first place)
we can get rid of `stm` again...

On the bright side, we were able to avoid uploading new `stm` releases for
over two years already, so it shouldn't cause too much trouble if GHC imposes
a strong preference on the `stm` package's version (this most likely will
mostly affect Linux distributions & similiar).

While at it, this also update the stm submodule to include relaxed
bounds to allow the upcoming base-4.11 version.

23 months agoMake zipWith and zipWith3 inlinable.
HE, Tao [Tue, 19 Sep 2017 20:58:19 +0000 (16:58 -0400)] 
Make zipWith and zipWith3 inlinable.

Reviewers: austin, hvr, bgamari, dfeuer

Reviewed By: dfeuer

Subscribers: rwbarton, thomie

GHC Trac Issues: #14224

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

23 months agoRestore function powModSecInteger
Olivier Chéron [Tue, 19 Sep 2017 20:58:01 +0000 (16:58 -0400)] 
Restore function powModSecInteger

The function existed in integer-gmp-0.5.1.0 but was removed as
part of integer-gmp2 rewrite in #9281.  This is to bring it back.

Test Plan: Case integerGmpInternals, with GMP 4.3.2 and GMP 6.1.2

Reviewers: austin, hvr, goldfire, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

23 months agocmm/CBE: Collapse blocks equivalent up to alpha renaming of local registers
Ben Gamari [Tue, 19 Sep 2017 20:57:41 +0000 (16:57 -0400)] 
cmm/CBE: Collapse blocks equivalent up to alpha renaming of local registers

As noted in #14226, the common block elimination pass currently
implements an extremely strict equivalence relation, demanding that two
blocks are equivalent including the names of their local registers. This
is quite restrictive and severely hampers the effectiveness of the pass.

Here we allow the CBE pass to collapse blocks which are equivalent up to
alpha renaming of locally-bound local registers. This is completely safe
and catches many more duplicate blocks.

Test Plan: Validate

Reviewers: austin, simonmar, michalt

Reviewed By: michalt

Subscribers: rwbarton, thomie

GHC Trac Issues: #14226

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

23 months agoFactor mkCoreApp and mkCoreApps
Arnaud Spiwack [Tue, 19 Sep 2017 20:57:25 +0000 (16:57 -0400)] 
Factor mkCoreApp and mkCoreApps

`mkCoreApps` re-implemented `mkCoreApp` in a recursive function,
rather than using a simple `foldl'` in order to avoid repeatingly
computing the type of the function argument. I've factored the two
logic into a new (internal) function `mkCoreType` which assumes that
the type is known. `mkCoreApp` and `mkCoreApps` are thin wrappers
around it.

Differences
- The assertion failure message of `mkCoreApps` has more
  information in it.
- `mkCoreApps` now special-cases coercion argument like
  `mkCoreApp` (previously they were given to `mk_val_app` instead)

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

23 months agousers-guide: Mention changes necessary due to #13391
Ben Gamari [Tue, 19 Sep 2017 20:57:08 +0000 (16:57 -0400)] 
users-guide: Mention changes necessary due to #13391

Some variant of this should also be added to the migration guide.

[skip ci]

Test Plan: Read it

Reviewers: goldfire, austin

Reviewed By: goldfire

Subscribers: rwbarton, thomie

GHC Trac Issues: #13391

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

23 months agobase: Add more detail to FD_SETSIZE related error message
Niklas Hambüchen [Tue, 19 Sep 2017 19:14:27 +0000 (15:14 -0400)] 
base: Add more detail to FD_SETSIZE related error message

Reviewers: bgamari, austin, hvr

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

23 months agobase: Make it less likely for fdReady() to fail on Windows sockets.
Niklas Hambüchen [Tue, 19 Sep 2017 19:12:56 +0000 (15:12 -0400)] 
base: Make it less likely for fdReady() to fail on Windows sockets.

See the added comment for details.

It's "less likely" because it can still fail if the socket happens to
have an FD larger than 1023, which can happen if many files are opened.

Until now, basic socket programs that use `hWaitForInput` were broken on
Windows.

That is because on Windows `FD_SETSIZE` defaults to 64, but pretty much
all GHC programs seem to have > 64 FDs open, so you can't actually
create a socket on which you can `select()`.

It errors with `fdReady: fd is too big` even with an example as simple
as the following (in this case, on my machine the `fd` is `284`):

  {-# LANGUAGE OverloadedStrings #-}

  import Control.Monad (forever)
  import Network.Socket
  import System.IO

  -- Simple echo server: Reads up to 10 chars from network, echoes them back.
  -- Uses the Handle API so that `hWaitForInput` can be used.
  main :: IO ()
  main = do
    sock <- socket AF_INET Stream 0
    setSocketOption sock ReuseAddr 1
    bind sock (SockAddrInet 1234 0x0100007f)
      -- 0x0100007f == 127.0.0.1 localhost
    listen sock 2
    forever $ do
      (connSock, _connAddr) <- accept sock
      putStrLn "Got connection"

      h <- socketToHandle connSock ReadWriteMode
      hSetBuffering h NoBuffering

      ready <- hWaitForInput h (5 * 1000) -- 5 seconds
      putStrLn $ "Ready: " ++ show ready

      line <- hGetLine h
      putStrLn "Got line"
      hPutStrLn h ("Got: " ++ line)
      hClose h

I'm not sure how this was not discovered earlier; for #13525 (where
`fdReady()` breaking completely was also discovered late) at least it
failed only when the timeout was non-zero, which is not used in ghc
beyond in `hWaitForInput`, but in this Windows socket case it breaks
even on the 0-timeout.

Maybe there is not actually anybody who uses sockets as handles on
Windows?

The workaround for now is to increase `FD_SETSIZE` on Windows;
increasing it is possible on Windows and BSD, see

https://stackoverflow.com/questions/7976388/increasing-limit-of-fd-setsi
ze-and-select

A real fix would be to move to IO Completion Ports on Windows, and thus
get rid of the last uses of `select()` (the other platforms already use
`poll()` but Windows doesn't have that).

Reviewers: bgamari, austin, hvr, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

23 months agorts: Fix typo in comment
Niklas Hambüchen [Tue, 19 Sep 2017 19:12:11 +0000 (15:12 -0400)] 
rts: Fix typo in comment

Reviewers: bgamari, austin, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

23 months agorts: Update comment about FreeBSD's unsigned FD_SETSIZE
Niklas Hambüchen [Tue, 19 Sep 2017 19:11:38 +0000 (15:11 -0400)] 
rts: Update comment about FreeBSD's unsigned FD_SETSIZE

Reviewers: bgamari, austin, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

23 months agobase: Fix fdReady() returning immediately for pipes on Windows.
Niklas Hambüchen [Tue, 19 Sep 2017 19:11:05 +0000 (15:11 -0400)] 
base: Fix fdReady() returning immediately for pipes on Windows.

See https://ghc.haskell.org/trac/ghc/ticket/13497#comment:17

Until now, the program

  import System.IO
  main = hWaitForInput stdin (5 * 1000)

didn't wait 5 seconds for input on Winodws, it terminated immediately.

This was because the `PeekNamedPipe()` function introduced in commit
94fee9e7 really only peeks, it doesn't block.  So if there's no data,
`fdReady(fd, msec)` would return immediately even when the given `msec`
timeout is not zero.

This commit fixes it by looping around `PeekNamedPipe()` with a `sleep(1
ms)`.

Apparently there's no better way to do this on Windows without switching
to IOCP.

In any case, this change should be strictly better than what was there
before.

Reviewers: bgamari, austin, hvr

Reviewed By: bgamari

Subscribers: Phyx, rwbarton, thomie

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

23 months agobase: Fix fdReady() potentially running forever for Windows Char devices.
Niklas Hambüchen [Tue, 19 Sep 2017 19:10:31 +0000 (15:10 -0400)] 
base: Fix fdReady() potentially running forever for Windows Char devices.

Reviewers: bgamari, austin, hvr

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

23 months agobase: Fix fdReady() potentially running forever on Windows.
Niklas Hambüchen [Tue, 19 Sep 2017 19:10:00 +0000 (15:10 -0400)] 
base: Fix fdReady() potentially running forever on Windows.

This fixes #13497 for Windows -- at least for the `if (isSock)` part; I
haven't investigated the case where it's not a socket yet.

Solved by copying the new current-time based waiting logic from the
non-Windows implementation above.

Reviewers: bgamari, austin, hvr

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

23 months agobase: fdReady(): Improve accuracy and simplify code.
Niklas Hambüchen [Tue, 19 Sep 2017 19:09:29 +0000 (15:09 -0400)] 
base: fdReady(): Improve accuracy and simplify code.

This is done by reusing the existing cross-platform
`getProcessElapsedTime()` function, which already provides nanosecond
monotonic clocks, and fallback for platforms that don't have those.

To do this, `getProcessElapsedTime()` had to be moved from a private RTS
symbol into the public interface.

Accuracy is improved in 2 ways:

* Use of the monotonic clock where available
* Measuring the total time spent waiting instead of a sum
  of intervals (between which there are small gaps)

Reviewers: bgamari, austin, hvr, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

23 months agoFix Windows build regression due to GhcPrelude change
Ben Gamari [Tue, 19 Sep 2017 19:58:20 +0000 (15:58 -0400)] 
Fix Windows build regression due to GhcPrelude change

23 months agocompiler: introduce custom "GhcPrelude" Prelude
Herbert Valerio Riedel [Tue, 19 Sep 2017 18:35:36 +0000 (14:35 -0400)] 
compiler: introduce custom "GhcPrelude" Prelude

This switches the compiler/ component to get compiled with
-XNoImplicitPrelude and a `import GhcPrelude` is inserted in all
modules.

This is motivated by the upcoming "Prelude" re-export of
`Semigroup((<>))` which would cause lots of name clashes in every
modulewhich imports also `Outputable`

Reviewers: austin, goldfire, bgamari, alanz, simonmar

Reviewed By: bgamari

Subscribers: goldfire, rwbarton, thomie, mpickering, bgamari

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

23 months agoOccurAnal: Ensure SourceNotes don't interfere with join-point analysis
Ben Gamari [Tue, 19 Sep 2017 15:16:55 +0000 (11:16 -0400)] 
OccurAnal: Ensure SourceNotes don't interfere with join-point analysis

In general ticks are problematic for join point analysis as described
in #14242.  However, source notes are intended to be a best-effort
annotation which shouldn't interfere with optimization. Special-case
these to ensure that tail-call information is still correct, even in the
presence of source note
ticks.

Test Plan: Validate

Reviewers: simonpj, austin

Reviewed By: simonpj

Subscribers: rwbarton, thomie

GHC Trac Issues: #14242

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

23 months agonativeGen: Consistently use blockLbl to generate CLabels from BlockIds
Ben Gamari [Tue, 19 Sep 2017 14:58:36 +0000 (10:58 -0400)] 
nativeGen: Consistently use blockLbl to generate CLabels from BlockIds

This fixes #14221, where the NCG and the DWARF code were apparently
giving two different names to the same block.

Test Plan: Validate with DWARF support enabled.

Reviewers: simonmar, austin

Subscribers: rwbarton, thomie

GHC Trac Issues: #14221

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

23 months agorts/RetainerProfile: Adding missing closure types to isRetainer
Ben Gamari [Tue, 19 Sep 2017 13:51:01 +0000 (09:51 -0400)] 
rts/RetainerProfile: Adding missing closure types to isRetainer

orzo in `#ghc` reported seeing a crash due to the retainer profiler encountering
a BLOCKING_QUEUE closure, which isRetainer didn't know about. I performed an
audit to make sure that all of the valid closure types were listed; they
weren't. This is my guess of how they should appear.

Test Plan: Validate

Reviewers: simonmar, austin, erikd

Reviewed By: simonmar

Subscribers: rwbarton, thomie

GHC Trac Issues: #14235

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

23 months agoFix unused-given-constraint bug
Simon Peyton Jones [Tue, 19 Sep 2017 11:37:13 +0000 (12:37 +0100)] 
Fix unused-given-constraint bug

This bug was shown up by Trac #14237.  It turned out
to be an outright error in TcSimplify.neededEvVars,
easily fixed.

I improved the comments.

23 months agoRemove redundant/obsolete CPP usage
Herbert Valerio Riedel [Tue, 19 Sep 2017 06:11:50 +0000 (08:11 +0200)] 
Remove redundant/obsolete CPP usage

This `#if 0`/`#endif` block has been around for over 10 years and
it became truly redundant in 36104d7a0d66df895c8275e3aa7cfe35a322ff04

23 months agoGeneralise constraint on `instance Monoid (Maybe a)` to Semigroup
Herbert Valerio Riedel [Tue, 19 Sep 2017 05:54:40 +0000 (07:54 +0200)] 
Generalise constraint on `instance Monoid (Maybe a)` to Semigroup

This now becomes possible due to the introduction of the
Semigroup=>Monoid superclass relation (see #14191).

Reviewers: ekmett, RyanGlScott, austin, bgamari

Reviewed By: ekmett, RyanGlScott, bgamari

Subscribers: rwbarton, thomie

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

23 months agoAllow opt+llc from LLVM5
Moritz Angermann [Fri, 28 Jul 2017 06:04:22 +0000 (14:04 +0800)] 
Allow opt+llc from LLVM5

Summary:
This bumps our LLVM version requirement to LLVM5,
which will likely be released before GHC 8.4.

Test Plan: validate

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, erikd

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

23 months ago[RTS] Add getObjectLoadStatus
Bartosz Nitka [Mon, 18 Sep 2017 14:53:56 +0000 (07:53 -0700)] 
[RTS] Add getObjectLoadStatus

This adds a function to the RTS linker API which lets the
user check the status of dynamically linked objects.

It was initially proposed by @afarmer in D2068.
It's useful for testing the linker and also for detecting retention
problems in production.

It takes a path, because it's easier to use path as key instead of producing
some stable handle.

It returns an enum instead of bool, because I see no reason for destroying
information. All the complexity is already out in the open, so there's
nothing to save the users from.

Test Plan: ./validate

Reviewers: simonmar, Phyx, bgamari, austin, erikd

Reviewed By: Phyx, bgamari

Subscribers: rwbarton, afarmer, thomie

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

23 months agotestsuite: Fix MonadFail test output for new ST instance
Ben Gamari [Sun, 17 Sep 2017 11:59:41 +0000 (07:59 -0400)] 
testsuite: Fix MonadFail test output for new ST instance

23 months agobase: Fix missing import of Control.Monad.Fail
Ben Gamari [Sun, 17 Sep 2017 04:18:06 +0000 (00:18 -0400)] 
base: Fix missing import of Control.Monad.Fail

23 months agoFix pointer tagging mistake
David Feuer [Sun, 17 Sep 2017 04:21:03 +0000 (00:21 -0400)] 
Fix pointer tagging mistake

f9c6d53fe997f1c560cda6f346f4b201711df37c led to #14036. The
problem turned out to be rather simple: the `obj` pointer was
being tagged using `obj + arity`. Because this is C, that's done
with *pointer arithmetic*, which is not at all what we want. Add
appropriate casts.

Reviewers: austin, bgamari, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14036

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

23 months agobase: Add missing MonadFail instance for strict ST
Ben Gamari [Sun, 17 Sep 2017 03:47:37 +0000 (23:47 -0400)] 
base: Add missing MonadFail instance for strict ST

Test Plan: Validate

Reviewers: hvr, RyanGlScott, austin

Reviewed By: RyanGlScott

Subscribers: rwbarton, thomie

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

23 months agobase: Enable TypeInType in Data.Type.Equality
Ben Gamari [Fri, 15 Sep 2017 22:57:43 +0000 (18:57 -0400)] 
base: Enable TypeInType in Data.Type.Equality

Otherwise compilation fails with,

    libraries/base/Data/Type/Equality.hs:145:4: error:
        • Data constructor ‘HRefl’ constrains the choice of kind parameter:
            k2 ~ k2
          Use TypeInType to allow this
        • In the definition of data constructor ‘HRefl’
          In the data type declaration for ‘:~~:’
        |
    145 |    HRefl :: a :~~: a
        |    ^

2 years agoRemove dead function TcUnify.wrapFunResCoercion
Arnaud Spiwack [Fri, 15 Sep 2017 18:36:39 +0000 (14:36 -0400)] 
Remove dead function TcUnify.wrapFunResCoercion

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

2 years agoRenamer now preserves location for IEThingWith list items
Alan Zimmerman [Fri, 15 Sep 2017 18:35:51 +0000 (14:35 -0400)] 
Renamer now preserves location for IEThingWith list items

Prior to this, in the RenamedSource for

    module Renaming.RenameInExportedType
      (
      MyType (NT)
      ) where

    data MyType = MT Int | NT

The (NT) was given the location of MyType earlier on the line in the
export list.

Also the location was discarded for any field labels, and replaced with
a `noLoc`.

Test Plan: ./validate

Reviewers: bgamari, austin

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14189

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

2 years agobase: Fix mixed tabs/spaces indentation in inputReady.c
Niklas Hambüchen [Fri, 15 Sep 2017 18:35:35 +0000 (14:35 -0400)] 
base: Fix mixed tabs/spaces indentation in inputReady.c

Reviewers: bgamari, austin, hvr

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

2 years agoFix #14228 by marking SumPats as non-irrefutable
Ryan Scott [Fri, 15 Sep 2017 18:34:58 +0000 (14:34 -0400)] 
Fix #14228 by marking SumPats as non-irrefutable

`isIrrefutableHsPat` should always return `False` for unboxed sum
patterns (`SumPat`s), since they always have at least one other
corresponding pattern of the same arity (since the minimum arity for a
`SumPat` is 2). Failure to do so causes incorrect code to be generated
for pattern synonyms that use unboxed sums, as shown in #14228.

Test Plan: make test TEST=T14228

Reviewers: austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #14228

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

2 years agoFix missing fields warnings in empty record construction, fix #13870
HE, Tao [Fri, 15 Sep 2017 18:34:42 +0000 (14:34 -0400)] 
Fix missing fields warnings in empty record construction, fix #13870

Test Plan: make test TEST=T13870

Reviewers: RyanGlScott, austin, bgamari, mpickering

Reviewed By: mpickering

Subscribers: mpickering, rwbarton, thomie, RyanGlScott

Tags: #ghc

GHC Trac Issues: #13870

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

2 years agoIgnore untracked in text, parsec and mtl submodules [skip ci]
Tamar Christina [Fri, 15 Sep 2017 18:34:26 +0000 (14:34 -0400)] 
Ignore untracked in text, parsec and mtl submodules [skip ci]

ignore all untracked changes in all submodules from the top level.
This matches the older settings for the other submodules and stops
litering `git status` output with files created by ./boot and make.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: hvr, rwbarton, thomie

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

2 years agoFix name of note
Ben Gamari [Wed, 13 Sep 2017 17:13:02 +0000 (13:13 -0400)] 
Fix name of note

[skip ci]

2 years agoBump submodule nofib (Semigroup now required)
Joachim Breitner [Thu, 14 Sep 2017 20:42:53 +0000 (16:42 -0400)] 
Bump submodule nofib (Semigroup now required)

This will unblock perf.haskell.org, which got stuck after 8ae263c.

2 years agoFix #13963.
Richard Eisenberg [Wed, 16 Aug 2017 18:33:06 +0000 (14:33 -0400)] 
Fix #13963.

This commit fixes several things:

1. RuntimeRep arg suppression was overeager for *visibly*-quantified
RuntimeReps, which should remain.

2. The choice of whether to used a Named TyConBinder or an anonymous
was sometimes wrong. Now, we do an extra little pass right before
constructing the tycon to fix these.

3. TyCons that normally cannot appear unsaturated can appear unsaturated
in :kind. But this fact was not propagated into the type checker.
It now is.

2 years agoTest #13938, with expect_broken
Richard Eisenberg [Wed, 16 Aug 2017 15:49:49 +0000 (11:49 -0400)] 
Test #13938, with expect_broken

test case: dependent/should_compile/T13938

2 years agoFix #13929 by adding another levity polymorphism check
Richard Eisenberg [Wed, 16 Aug 2017 15:35:26 +0000 (11:35 -0400)] 
Fix #13929 by adding another levity polymorphism check

test case: typecheck/should_fail/T13929

2 years agoMake rejigConRes do kind substitutions
Richard Eisenberg [Wed, 16 Aug 2017 14:43:41 +0000 (10:43 -0400)] 
Make rejigConRes do kind substitutions

This was a lurking bug discovered on the hunt for #13910, but
it doesn't fix that bug. The old version of rejigConRes was
just wrong, forgetting to propagate a kind-change.

2 years agoFix #13909 by tweaking an error message.
Richard Eisenberg [Tue, 15 Aug 2017 23:07:59 +0000 (19:07 -0400)] 
Fix #13909 by tweaking an error message.

GHC was complaining about numbers of arguments when the real
problem is impredicativity.

test case: typecheck/should_fail/T13909

2 years agotestsuite: Fix dependence on grep behavior in T8129
Ben Gamari [Thu, 14 Sep 2017 17:05:15 +0000 (13:05 -0400)] 
testsuite: Fix dependence on grep behavior in T8129

grep was considering the output to be binary on my machine, resulting in a
spurious test failure.

2 years agoBump primitive submodule
Ben Gamari [Wed, 13 Sep 2017 23:42:39 +0000 (19:42 -0400)] 
Bump primitive submodule

2 years agonativeGen: A few strictness fixes
Ben Gamari [Wed, 13 Sep 2017 23:26:56 +0000 (19:26 -0400)] 
nativeGen: A few strictness fixes

Test Plan: Validate

Reviewers: austin, simonmar

Subscribers: rwbarton, thomie

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

2 years agoFix #13407 by suppressing invisibles better.
Richard Eisenberg [Tue, 15 Aug 2017 22:04:32 +0000 (18:04 -0400)] 
Fix #13407 by suppressing invisibles better.

Previously, the iface-invisible-suppresser assumed that all
invisible things are up front. Not true!

test case: ghci/scripts/T13407

2 years agoTest #12938 in indexed-types/should_compile/T12938
Richard Eisenberg [Tue, 15 Aug 2017 18:56:31 +0000 (14:56 -0400)] 
Test #12938 in indexed-types/should_compile/T12938

2 years agoRegression test for #12742
Richard Eisenberg [Tue, 15 Aug 2017 18:52:53 +0000 (14:52 -0400)] 
Regression test for #12742

Location: dependent/should_compile/T12742

2 years agoTest #14038 in dependent/should_compile/T14038
Richard Eisenberg [Tue, 8 Aug 2017 22:20:42 +0000 (18:20 -0400)] 
Test #14038 in dependent/should_compile/T14038

2 years agoAdd test for Trac #14232
Simon Peyton Jones [Thu, 14 Sep 2017 16:20:14 +0000 (17:20 +0100)] 
Add test for Trac #14232

2 years ago[RTS] Make -po work
Bartosz Nitka [Thu, 14 Sep 2017 09:50:05 +0000 (02:50 -0700)] 
[RTS] Make -po work

db2a667655506c43dd3c8260d29031bde55f1bee added `-po` option, but
the part that parses it was missing.

Test Plan:
On a simple file:
```
./inplace/bin/ghc-stage2 A.hs -prof -main-is A; ./A +RTS -P -potest
```
produced test.prof file and didn't produce A.prof file.

```
./A +RTS -P
```
produced A.prof file

Reviewers: simonmar, bgamari, austin, erikd

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

2 years agoRemove unused variable binding
Simon Peyton Jones [Thu, 14 Sep 2017 10:40:09 +0000 (11:40 +0100)] 
Remove unused variable binding

2 years agoInterim fix for a nasty type-matching bug
Simon Peyton Jones [Wed, 13 Sep 2017 08:26:26 +0000 (09:26 +0100)] 
Interim fix for a nasty type-matching bug

The type matcher in types/Unify.hs was producing a substitution
that had variables from the template in its range.  Yikes!

This patch, documented in Note [Matching in the presence of casts],
is an interm fix.  Richard and I don't like it much, and are
pondering a better solution (Trac #14119).

All this came up in investigating Trac #13910. Alas this patch
doesn't fix #13910, which still has ASSERT failures, so I have
not yet added a test.  But the patch does fix a definite bug.

2 years agoRefactor tcInferApps
Simon Peyton Jones [Sun, 3 Sep 2017 11:30:59 +0000 (12:30 +0100)] 
Refactor tcInferApps

This is a simple refactor

* Remove an unnecessary accumulating argument (acc_hs_apps) from
  the 'go' function

* And put 'n' first in the same function

2 years agoRefactor to eliminate FamTyConShape
Simon Peyton Jones [Sun, 3 Sep 2017 11:18:10 +0000 (12:18 +0100)] 
Refactor to eliminate FamTyConShape

Consider this note (TcTyClsDecls)

  Note [Type-checking type patterns]
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  When typechecking the patterns of a family instance declaration, we can't
  rely on using the family TyCon itself, because this is sometimes called
  from within a type-checking knot. (Specifically for closed type families.)
  The FamTyConShape gives just enough information to do the job.

I realised that this exact purpose can be served by TcTyCons, and
in fact rather better.  So this patch

* Refactors FamTyConShape out of existence, replacing it with TcTyCOn

* I also got rid Type.filterOutInvisibleTyVars, which was a very
  complex way to do something quite simple.  I replaced the calls
  with TyCon.tyConVisibleTyVars.

No change in behaviour.

2 years agoTidying could cause ill-kinded types
Simon Peyton Jones [Sat, 2 Sep 2017 17:29:11 +0000 (18:29 +0100)] 
Tidying could cause ill-kinded types

I found (Trac #14175) that the tidying we do when reporting
type error messages could cause a well-kinded type to become
ill-kinded. Reason: we initialised the tidy-env with a
completely un-zonked TidyEnv accumulated in the TcLclEnv
as we come across lexical type-varialbe bindings.

Solution: zonk them.

But I ended up refactoring a bit:

* Get rid of tcl_tidy :: TidyEnv altogether

* Instead use tcl_bndrs :: TcBinderStack
  This used to contain only Ids, but now I've added those
  lexically scoped TyVars too.

* Change names:
     TcIdBinderStack -> TcBinderStack
     TcIdBinder      -> TcBinder
     extendTcIdBndrs -> extendTcBinderStack

* Now tcInitTidyEnv can grab those TyVars from the
  tcl_bndrs, zonk, and tidy them.

The only annoyance is that I had to add TcEnv.hs-boot, to
break the recursion between the zonking code and the
TrRnMonad functions like addErrTc that call tcInitTidyEnv.
Tiresome, but in fact that file existed already.

2 years agoFix subtle bug in TcTyClsDecls.mkGADTVars
Simon Peyton Jones [Sat, 2 Sep 2017 17:13:32 +0000 (18:13 +0100)] 
Fix subtle bug in TcTyClsDecls.mkGADTVars

This bug was revealed by Trac #14162.  In a GADT-style data-family
instance we ended up a data constructor whose type mentioned
an out-of-scope variable.  (This variable was in the kind of
a variable in the kind of a variable.)

Only Lint complained about this (actually only when the
data constructor was injected into the bindings by CorePrep).
So it doesn't matter much -- but it's a solid bug and might
bite us some day.

It took me quite a while to unravel because the test case was itself
quite tricky.  But the fix is easy; just add a missing binding to the
substitution we are building up.  It's in the regrettably-subtle
mkGADTVars function.

2 years agoMore refinements to debugPprType
Simon Peyton Jones [Sat, 2 Sep 2017 17:10:49 +0000 (18:10 +0100)] 
More refinements to debugPprType

2 years agoNo need to check ambiguity for visible type args
Simon Peyton Jones [Fri, 25 Aug 2017 17:14:16 +0000 (18:14 +0100)] 
No need to check ambiguity for visible type args

Seems unnecesarry to me.

2 years agoModel divergence of retry# as ThrowsExn, not Diverges
Ben Gamari [Wed, 13 Sep 2017 16:22:27 +0000 (12:22 -0400)] 
Model divergence of retry# as ThrowsExn, not Diverges

The demand signature of the retry# primop previously had a Diverges
result.  However, this caused the demand analyser to conclude that a
program of the shape,

    catchRetry# (... >> retry#)

would diverge. Of course, this is plainly wrong; catchRetry#'s sole
reason to exist is to "catch" the "exception" thrown by retry#. While
catchRetry#'s demand signature correctly had the ExnStr flag set on its
first argument, indicating that it should catch divergence, the logic
associated with this flag doesn't apply to Diverges results. This
resulted in #14171.

The solution here is to treat the divergence of retry# as an exception.
Namely, give it a result type of ThrowsExn rather than Diverges.

Updates stm submodule for tests.

Test Plan: Validate with T14171

Reviewers: simonpj, austin

Subscribers: rwbarton, thomie

GHC Trac Issues: #14171, #8091

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

2 years agorts: Add regsterCc(s)List to RTS symbols list
Ben Gamari [Wed, 13 Sep 2017 19:51:42 +0000 (15:51 -0400)] 
rts: Add regsterCc(s)List to RTS symbols list

These are helpers added in a8da0de27e600211f04601ac737c329d6603c700 to
register cost centres. They are invoked while loading profiled code and
therefore need to be in the RTS's symbol list.

Test Plan: Validate, trying starting GHCi in profiled GHC build

Reviewers: austin, erikd, simonmar

Subscribers: rwbarton, thomie, RyanGlScott

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

2 years agoClarify seq documentation
Sibi Prabakaran [Wed, 13 Sep 2017 16:33:22 +0000 (12:33 -0400)] 
Clarify seq documentation

Improves the documentation by specifying that the first argument in
seq function is evaluated to WHNF.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: harendra, rwbarton, thomie

GHC Trac Issues: #14213

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

2 years agoSimplify Data.Type.Equality.==
David Feuer [Wed, 13 Sep 2017 16:25:11 +0000 (12:25 -0400)] 
Simplify Data.Type.Equality.==

Contrary to previous comments, we can calculate `==` for types
in an extremely general fashion. The approach used here is actually
the one mistakenly rejected as impossible. There will be some cases
when the previous version was able to reduce and this one is not,
particularly for types in `*` that are unknown, but known equal.
However, the new behavior is much more uniform. Within the
established framework of equality testing by pattern matching,
it does a better job than the previous version.

Reviewers: goldfire, austin, hvr, bgamari, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: RyanGlScott, rwbarton, thomie

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

2 years agoBetter document TypeRep patterns
Ben Gamari [Wed, 13 Sep 2017 16:23:47 +0000 (12:23 -0400)] 
Better document TypeRep patterns

As pointed out in #14199 these are rather non-trivial; extra
documentation is in order.

[skip ci]

Test Plan: Read it

Reviewers: dfeuer, austin, hvr

Subscribers: rwbarton, thomie

GHC Trac Issues: #14199

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

2 years agoOption "-ddump-rn-ast" dumps imports and exports too
Alan Zimmerman [Wed, 13 Sep 2017 12:02:42 +0000 (14:02 +0200)] 
Option "-ddump-rn-ast" dumps imports and exports too

Summary:
Previously the renamed source decls only were dumped, now the imports, exports
and doc_hdr are too.

Test Plan: ./validate

Reviewers: bgamari, austin

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14197

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

2 years agoAdd non-ASCII isLetter True example
Chris Martin [Thu, 7 Sep 2017 02:36:03 +0000 (22:36 -0400)] 
Add non-ASCII isLetter True example

2 years agoFix @since annotations in GHC.Stats
Dmitry Ivanov [Tue, 12 Sep 2017 07:18:16 +0000 (09:18 +0200)] 
Fix @since annotations in GHC.Stats

2 years agoMake IntPtr and WordPtr as instance of Data.Data typeclass, fix #13115
HE, Tao [Wed, 13 Sep 2017 12:26:32 +0000 (08:26 -0400)] 
Make IntPtr and WordPtr as instance of Data.Data typeclass, fix #13115

Test Plan: ./validate

Reviewers: austin, hvr, bgamari, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: RyanGlScott, rwbarton, thomie

GHC Trac Issues: #13115

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

2 years ago[RTS] Harden against buffer overflow
Bartosz Nitka [Wed, 13 Sep 2017 12:28:00 +0000 (08:28 -0400)] 
[RTS] Harden against buffer overflow

This sprintf is safe thanks to the guarantees on the format strings that
we pass to it.  Well, almost. The GR_FILENAME_FMT_GUM format would not
have satisfied them if it was still used.

If someone makes a mistake that's a potential privilege escalation,
so I think it's reasonable to switch to snprintf to protect against
that remote possibility.

Test Plan: it builds, CI

Reviewers: simonmar, bgamari, austin, erikd

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

2 years agoUse ar for -staticlib
Moritz Angermann [Wed, 13 Sep 2017 12:24:46 +0000 (08:24 -0400)] 
Use ar for -staticlib

Hopefully we can get rid of libtool, by using ar only

Depends on:  D3579

Test Plan: validate

Reviewers: austin, hvr, bgamari, erikd

Reviewed By: bgamari

Subscribers: rwbarton, thomie, erikd

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

2 years agoClarify Data.Data documentation
David Feuer [Wed, 13 Sep 2017 12:22:42 +0000 (08:22 -0400)] 
Clarify Data.Data documentation

Explain much more clearly when `dataCast1` and `dataCast2` can
have non-trivial implementations. On a couple different occasions,
I have attempted to write better defaults for these, only to
discover that we can't really do that. The new documentation
implicitly explains why that is.

[skip ci]

Reviewers: austin, hvr, bgamari, angerman

Reviewed By: bgamari, angerman

Subscribers: angerman, rwbarton, thomie

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

2 years agoDriverMkDepend: Kill redundant import
Ben Gamari [Wed, 13 Sep 2017 12:22:20 +0000 (08:22 -0400)] 
DriverMkDepend: Kill redundant import

Reviewers: austin

Subscribers: rwbarton, thomie

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

2 years agorts: Print message before SIGUSR2 backtrace
Ben Gamari [Wed, 13 Sep 2017 12:21:20 +0000 (08:21 -0400)] 
rts: Print message before SIGUSR2 backtrace

Reviewers: austin, erikd, simonmar

Subscribers: rwbarton, thomie

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

2 years agoAdd regression test for #14209
Ryan Scott [Wed, 13 Sep 2017 13:37:24 +0000 (09:37 -0400)] 
Add regression test for #14209

Summary:
Commit 0257dacf228024d0cc6ba247c707130637a25580
(`Refactor bindHsQTyVars and friends`) ended up fixing #14209. Let's
add a regression test so that it stays fixed.

Test Plan: make test TEST=T14209

Reviewers: austin, bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14209

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