ghc.git
4 years agoMake T9579 parallel-safe and add build outputs to .gitignore
Edward Z. Yang [Fri, 17 Apr 2015 10:14:41 +0000 (03:14 -0700)] 
Make T9579 parallel-safe and add build outputs to .gitignore

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
4 years agoStub out pkgState with non-error, helps with debugging.
Edward Z. Yang [Mon, 6 Apr 2015 18:32:14 +0000 (11:32 -0700)] 
Stub out pkgState with non-error, helps with debugging.

Summary:
When we use -dppr-debug, we'll sometimes attempt to
hit the pkgState to give more detailed information.  It's pretty
annoying to have this fail because we haven't filled in the
pkgState: we can still get useful debugging information by
printing the raw package key.  To avoid this, we just put
in some empty stub pkgState, to be filled in later.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: simonpj, austin

Subscribers: thomie

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

4 years agoComments only.
Edward Z. Yang [Tue, 7 Apr 2015 20:38:52 +0000 (13:38 -0700)] 
Comments only.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: comments only

Reviewers: simonpj, austin, goldfire

Subscribers: thomie

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

4 years agoDocumentation for rnImports/rnImportDecl.
Edward Z. Yang [Fri, 3 Apr 2015 03:59:07 +0000 (20:59 -0700)] 
Documentation for rnImports/rnImportDecl.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: comments only

Reviewers: simonpj, austin

Subscribers: thomie

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

4 years agoBetter hints when RTS options not available (Trac #9579)
Javran Cheng [Fri, 17 Apr 2015 00:52:00 +0000 (10:52 +1000)] 
Better hints when RTS options not available (Trac #9579)

This patch provides user with a better hint when most RTS options
are not available (not compiled with `-rtsopts`).

A new field "rtsOptsEnabled" is added into RtsFlags.MiscFlags to
tell the availablity of RTS options.

Some concerns:
* Unlike other flag fields in "libraries/base/GHC/RTS/Flags.hsc",
  "RtsOptsEnabled" is defined in "includes/RtsAPI.h" and lacks
  constant macros. Therefore In "GHC.RTS", "RtsOptsEnabled" simply
  derives Enum instance and reads as of type "CInt".

* There are other ways to change RTS options (e.g. `-with-rtsopts`),
  but it might be too verbose to mention.

Test Plan: validate

Reviewers: austin, hvr, thomie, simonmar

Reviewed By: thomie

Subscribers: thomie, rwbarton

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

GHC Trac Issues: #9579

4 years agoRename tests so that they have a unique name.
Iavor S. Diatchki [Thu, 16 Apr 2015 21:29:07 +0000 (14:29 -0700)] 
Rename tests so that they have a unique name.

4 years agoFix test output
Iavor S. Diatchki [Thu, 16 Apr 2015 19:45:01 +0000 (12:45 -0700)] 
Fix test output

4 years agoFix test output.
Iavor S. Diatchki [Thu, 16 Apr 2015 19:41:16 +0000 (12:41 -0700)] 
Fix test output.

4 years agoFixes (hopefully!) T9858
Iavor S. Diatchki [Thu, 16 Apr 2015 18:13:24 +0000 (11:13 -0700)] 
Fixes (hopefully!) T9858

The changes are:
  1. No impredicative types in `Typeable`
  2. Distinguish normal tuples, from tuples of constraints.

4 years agoAdd exception for `KnownNat` and `KnownSymbol` in super classes.
Iavor S. Diatchki [Thu, 16 Apr 2015 16:47:28 +0000 (09:47 -0700)] 
Add exception for `KnownNat` and `KnownSymbol` in super classes.

The situation is similar to `Typeable`---we can't set the evidence
outside the solver because we have custom solving rules.  This is safe
because the computed super-class instances can't possibly depend
on the new instance.

4 years agoCall Arity: Trade precision for performance in large mutually recursive groups
Joachim Breitner [Wed, 15 Apr 2015 14:25:13 +0000 (16:25 +0200)] 
Call Arity: Trade precision for performance in large mutually recursive groups

Sometimes (especial with derived Data instances, it seems), one can have
very large mutually recursive bindings. Calculating the Call Arity
analysis result with full precision is an expensive operation in these
case. So above a certain threshold (25, for no good reason besides
intuition), skip this calculation and assume the recursion is not
linear, which is a conservative result.

With this, the Call Arity analysis accounts for 3.7% of the compile time
of haskell-src-exts. Fixes #10293

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

4 years agoImprove Call Arity performance
Joachim Breitner [Wed, 15 Apr 2015 11:32:32 +0000 (13:32 +0200)] 
Improve Call Arity performance

This improves how the Call Arity deals with "boring" variables. Boring
variables are those where it does not bother to include in the analysis
result, so whenever something is looked up in the analysis result, we
have to make a conservative assumption about them.

Previously, we extended the result with such conservative information
about them, to keep the code uniform, but that could blow up the amount
of data passed around, even if only temporarily, and slowed things down.

We now pass around an explicit list (well, set) of variable that are
boring and take that into account whenever we use the result. Not as
pretty, but noticably faster.

4 years agoFix fundep coverage-condition check for poly-kinds
Simon Peyton Jones [Wed, 15 Apr 2015 09:28:40 +0000 (10:28 +0100)] 
Fix fundep coverage-condition check for poly-kinds

See Note [Closing over kinds in coverage] in FunDeps.
I'd already fixed this bug once, for Trac #8391, but I put the
call to closeOverKinds in the wrong place, so Trac #10109
failed.  (It checks the /liberal/ coverage condition, which

The fix was easy: move the call to the right place!

4 years agoDo not allow Typeable on constraints (Trac #9858)
Simon Peyton Jones [Tue, 14 Apr 2015 14:39:01 +0000 (15:39 +0100)] 
Do not allow Typeable on constraints (Trac #9858)

The astonishingly-ingenious trio of
Shachaf Ben-Kiki, Ørjan Johansen and Nathan van Doorn
managed to persuade GHC 7.10.1 to cough up unsafeCoerce.

That is very bad. This patch fixes it by no allowing Typable
on Constraint-kinded things.  And that seems right, since
it is, in effect, a form of impredicative polymorphism,
which Typeable definitely doesn't support.

We may want to creep back in the direction of allowing
Typeable on constraints one day, but this is a good
fix for now, and closes a terrible hole.

4 years agoImplement -f[no-]print-unicode-syntax flag for unicode syntax output (#8959)
Bertram Felgenhauer [Tue, 14 Apr 2015 14:10:52 +0000 (09:10 -0500)] 
Implement -f[no-]print-unicode-syntax flag for unicode syntax output (#8959)

There is currently no way to separate whether UnicodeSyntax is accepted
for input from the corresponding output syntax using unicode symbols.
This patch implements a separate flag for affecting ghc(i)'s output.

Signed-off-by: Bertram Felgenhauer <int-e@gmx.de>
Reviewed By: nomeata, austin

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

GHC Trac Issues: #8959

4 years agoApiAnnotations : lexer discards comment close in nested comment
Alan Zimmerman [Tue, 14 Apr 2015 12:32:52 +0000 (07:32 -0500)] 
ApiAnnotations : lexer discards comment close in nested comment

When parsing a nested comment, such as

{-
  {-  nested comment  -}
  {-# nested pragma  #-}
-}

The lexer returns the comment annotation as

{-
  {-  nested comment
  {-# nested pragma  #
-}

Restore the missing comment end markers in the annotation.

Reviewed By: austin

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

GHC Trac Issues: #10277

4 years agoAPI Annotations : ExprWithTySig processing discards annotated spans
Alan Zimmerman [Tue, 14 Apr 2015 12:32:40 +0000 (07:32 -0500)] 
API Annotations : ExprWithTySig processing discards annotated spans

In RdrHsSyn.checkAPat the processing for ExprWithTySig is defined as

   ExprWithTySig e t _ -> do e <- checkLPat msg e
                             -- Pattern signatures are parsed as sigtypes,
                             -- but they aren't explicit forall points.  Hence
                             -- we have to remove the implicit forall here.
                             let t' = case t of
                                        L _ (HsForAllTy Implicit _ _
                                             (L _ []) ty) -> ty
                                        other -> other
                             return (SigPatIn e (mkHsWithBndrs t'))

The t' variable ends up losing its original SrcSpan in the first case
branch. This results in annotations becoming detached from the AST.

Reviewed By: austin

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

GHC Trac Issues: #10255

4 years agoRemove LlvmCodeGen panic variants.
Edward Z. Yang [Tue, 14 Apr 2015 12:32:17 +0000 (07:32 -0500)] 
Remove LlvmCodeGen panic variants.

It's pretty irritating having hasktags with multiple top-level
declarations with the same type; hasktags can't figure out which
declaration you actually wanted.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Reviewed By: dterei, austin

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

4 years agoAdd "error:" prefix to error-messages
Konstantine Rybnikov [Tue, 14 Apr 2015 06:38:54 +0000 (01:38 -0500)] 
Add "error:" prefix to error-messages

Add "error:" prefix to error-messages, also lowercase "Warning:"
message to match GCC behavior closer.

Reviewed By: thomie, austin

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

GHC Trac Issues: #10021

4 years agoComments and white space only
Simon Peyton Jones [Tue, 14 Apr 2015 08:21:27 +0000 (09:21 +0100)] 
Comments and white space only

4 years agoComments only
Simon Peyton Jones [Tue, 14 Apr 2015 08:21:00 +0000 (09:21 +0100)] 
Comments only

4 years agoZap usage info in CSE (Trac #10218)
Simon Peyton Jones [Tue, 14 Apr 2015 08:20:42 +0000 (09:20 +0100)] 
Zap usage info in CSE (Trac #10218)

Trac #10218 reports a subtle bug that turned out to be:

- CSE invalidated the usage information computed
  by earlier demand analysis, by increasing sharing

- that made a single-entry thunk into a multi-entry thunk

- and with -feager-blackholing, that led to <<loop>>

The patch fixes it by making the CSE pass zap usage information for
let-bound identifiers.   It can be restored by -flate-dmd-anal.

(But making -flate-dmd-anal the default needs some careful work;
see Trac #7782.)

4 years agoparser : the API annotation on opt_sig is being discarded
Alan Zimmerman [Tue, 14 Apr 2015 06:17:58 +0000 (01:17 -0500)] 
parser : the API annotation on opt_sig is being discarded

The opt_sig production is defined as

  opt_sig :: { ([AddAnn],Maybe (LHsType RdrName)) }
          : {- empty -}                   { ([],Nothing) }
          | '::' sigtype                  { ([mj AnnDcolon $1],Just $2) }

It is used in the alt and decl_no_th productions, but neither of them
add the returned annotations.

This commit captures the annotations in the calling productions.

Reviewed By: austin

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

GHC Trac Issues: #10254

4 years agoparser: API Annotations : guardquals1 does not annotate commas properly
Alan Zimmerman [Tue, 14 Apr 2015 06:17:48 +0000 (01:17 -0500)] 
parser: API Annotations : guardquals1 does not annotate commas properly

The `guardquals1` production includes

   : guardquals1 ',' qual  {% addAnnotation (gl $ last $ unLoc $1) AnnComma
                                             (gl $2) >>
                               return (sLL $1 $> ($3 : unLoc $1)) }

The AnnComma should be attached to `(gl $ head $ unLoc $1)`, rather than
`last`.

Reviewed By: austin

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

GHC Trac Issues: #10256

4 years agoparser: opt_kind_sig has incorrect SrcSpan
Alan Zimmerman [Tue, 14 Apr 2015 06:16:48 +0000 (01:16 -0500)] 
parser: opt_kind_sig has incorrect SrcSpan

The production for opt_kind_sig is

  opt_kind_sig :: { Located (Maybe (LHsKind RdrName)) }
          :                             { noLoc Nothing }
          | '::' kind                   {% ajl (sLL $1 $> (Just $2)) AnnDcolon (gl $1) }

The outer Location is used only to get the full span for the enclosing
declration, and is then stripped. The inner LHsKind then has a SrcSpan that does
not include the '::'

Extend the SrcSpan on $2 to include $1

Reviewed By: austin

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

GHC Trac Issues: #10209

4 years agouse projectVersion from DynFlags rather than cProjectVersion for versionedAppDir
Luite Stegeman [Tue, 14 Apr 2015 06:13:27 +0000 (01:13 -0500)] 
use projectVersion from DynFlags rather than cProjectVersion for versionedAppDir

Reviewed By: edsko, austin

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

GHC Trac Issues: #10232

4 years agoDerive Generic instance for Data.Version.Version
Herbert Valerio Riedel [Tue, 14 Apr 2015 06:12:38 +0000 (01:12 -0500)] 
Derive Generic instance for Data.Version.Version

Reviewed By: austin

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

4 years agoDerive Generic instance for System.Exit.ExitCode
Herbert Valerio Riedel [Tue, 14 Apr 2015 06:12:22 +0000 (01:12 -0500)] 
Derive Generic instance for System.Exit.ExitCode

Reviewed By: austin

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

4 years agoFix autoconf's check for create_timer()
Austin Seipp [Tue, 14 Apr 2015 06:12:09 +0000 (01:12 -0500)] 
Fix autoconf's check for create_timer()

GHC build system have custom autoconf check for `create_timer()`
function from librt. Check description says that it checks for
`CLOCK_REALTIME` timer, but checking code also checks for
`CLOCK_PROCESS_CPUTIME_ID` timer, which is not commonly present (for
example, FreeBSD doesn't have it). This makes whole check fail despite
the fact that FreeBSD have `create_timer()` call and supports
`CLOCK_REALTIME`. As a consequence, GHC RTS falls back to using SIGALRM
for its timing machinery. Not only it's very ancient codepath, it also
break some FFI bindings to C code that isn't prepared for syscall
interruption caused by SIGALRM delivery.

Grepping through ghc source code reveals that `USE_TIMER_CREATE`
defininition in the config.h doesn't imply having
`CLOCK_PROCESS_CPUTIME_ID`. The only place where
`CLOCK_PROCESS_CPUTIME_ID` is used is rts/posix/GetTime.c and this code
handles the absence of `CLOCK_PROCESS_CPUTIME_ID` gracefully.

This patch makes autoconf checking code to check only for
`timer_create(CLOCK_REALTIME, ...)` and fixes check description.

Reviewed By: austin

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

4 years agoconfigure : LLVM and LD detections improvements (#10234).
Erik de Castro Lopo [Wed, 8 Apr 2015 05:11:38 +0000 (15:11 +1000)] 
configure : LLVM and LD detections improvements (#10234).

* distrib/configure.ac.in : Detect correct version of LLVM tools as
  was done for the top level configure.ac in 42448e3757.
* aclocal.m4 : Add a FIND_LD macro that can be used in both
  configure scripts.
* Use new FIND_LD macro in both configure scripts.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Test Plan: validate on amd64-linux and armhf-linux.

Reviewers: rwbarton, austin

Subscribers: thomie

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

GHC Trac Issues: #10234

4 years agoTypos in error messages and in comments
Gabor Greif [Fri, 10 Apr 2015 08:00:50 +0000 (10:00 +0200)] 
Typos in error messages and in comments

4 years agoMake the evidence in a CtGiven into an EvId
Simon Peyton Jones [Thu, 9 Apr 2015 16:36:41 +0000 (17:36 +0100)] 
Make the evidence in a CtGiven into an EvId

Note [Bind new Givens immediately] in TcRnTypes

We were never using the generality.  Result: less code, more efficient.
Cake for everyone.

4 years agoComments only
Simon Peyton Jones [Thu, 9 Apr 2015 14:03:05 +0000 (15:03 +0100)] 
Comments only

4 years agoComments in rejigConRes
Simon Peyton Jones [Thu, 9 Apr 2015 14:02:34 +0000 (15:02 +0100)] 
Comments in rejigConRes

4 years agoComments about AnyK
Simon Peyton Jones [Thu, 9 Apr 2015 14:02:08 +0000 (15:02 +0100)] 
Comments about AnyK

4 years agoImport rand using capi
Reid Barton [Thu, 9 Apr 2015 15:31:20 +0000 (11:31 -0400)] 
Import rand using capi

Summary: Android has no rand symbol (it's a static inline function there).

Test Plan: ghc-android builds

Reviewers: trofi, austin, hvr

Reviewed By: hvr

Subscribers: thomie

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

GHC Trac Issues: #10274

4 years agoFixes a compiler error with -DDEBUG (#10265)
Dave Laing [Wed, 8 Apr 2015 18:38:59 +0000 (14:38 -0400)] 
Fixes a compiler error with -DDEBUG (#10265)

Test Plan: validate

Reviewers: austin, ezyang, erikd, rwbarton

Reviewed By: ezyang, erikd, rwbarton

Subscribers: erikd, thomie

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

GHC Trac Issues: #10265

4 years agoTest Trac #8030
Simon Peyton Jones [Wed, 8 Apr 2015 08:43:20 +0000 (09:43 +0100)] 
Test Trac #8030

4 years agoIgnore temporary ./configure files.
Edward Z. Yang [Tue, 7 Apr 2015 20:44:51 +0000 (13:44 -0700)] 
Ignore temporary ./configure files.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
4 years agoAxe one-shot sig-of
Edward Z. Yang [Tue, 2 Dec 2014 09:08:59 +0000 (01:08 -0800)] 
Axe one-shot sig-of

Summary:
We're getting rid of -sig-of foo:A usage, because
it doesn't make sense in any compilation mode besides one-shot,
and we don't expect users to use it anyway.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: simonpj, austin

Subscribers: thomie

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

4 years agoCommit missing T10148 files and ignore the built executable.
Edward Z. Yang [Tue, 7 Apr 2015 18:59:09 +0000 (11:59 -0700)] 
Commit missing T10148 files and ignore the built executable.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
4 years agoSupport for multiple signature files in scope.
Edward Z. Yang [Wed, 8 Oct 2014 03:54:54 +0000 (20:54 -0700)] 
Support for multiple signature files in scope.

Summary:
A common pattern when programming with signatures is to combine multiple
signatures together (signature linking).  We achieve this by making it
not-an-error to have multiple, distinct interface files for the same module
name, as long as they have the same backing implementation.  When a user
imports a module name, they get ALL matching signatures dumped into their
scope.

On the way, I refactored the module finder code, which now distinguishes
between exact finds (when you had a 'Module') and regular finds (when
you had a 'ModuleName').  I also refactored the package finder code to
use a Monoid instance on LookupResult to collect together various results.

ToDo: At the moment, if a signature is declared in the local package,
it completely overrides any remote signatures.  Eventually, we'll want
to also pull in the remote signatures (or even override the local signature,
if the full implementation is available.)  There are bunch of ToDos in the
code for what to do once this is done.

ToDo: At the moment, whenever a module name lookup occurs in GHCi and we
would have seen a signature, we instead continue and return the Module
for the backing implementation.  This is correct for most cases, but there
might be some situations where we want something a little more fine-grained
(e.g. :browse should only list identifiers which are available through
the in-scope signatures, and not ALL of them.)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: simonpj, hvr, austin

Subscribers: carter, thomie

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

GHC Trac Issues: #9252

4 years agoFinal error message wibble
Simon Peyton Jones [Tue, 7 Apr 2015 16:52:14 +0000 (17:52 +0100)] 
Final error message wibble

4 years agoMore error message wibbles
Simon Peyton Jones [Tue, 7 Apr 2015 16:33:44 +0000 (17:33 +0100)] 
More error message wibbles

..due to suppressing base-package module names.

Needs a submodule update on array.

4 years agoTest Trac #10148
Simon Peyton Jones [Tue, 7 Apr 2015 16:20:43 +0000 (17:20 +0100)] 
Test Trac #10148

4 years agoThe production for squals is incorrect; see D806 for specifics.
Alan Zimmerman [Tue, 7 Apr 2015 14:10:27 +0000 (09:10 -0500)] 
The production for squals is incorrect; see D806 for specifics.

This diff depends on D803.

Reviewed By: austin

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

GHC Trac Issues: #10214

4 years agoThe production for `pquals` is incorrect; the specifics are in D803.
Alan Zimmerman [Tue, 7 Apr 2015 14:10:18 +0000 (09:10 -0500)] 
The production for `pquals` is incorrect; the specifics are in D803.

Reviewed By: austin

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

GHC Trac Issues: #10207

4 years agoDon't repeat package key with -dppr-debug when package info is missing.
Edward Z. Yang [Tue, 7 Apr 2015 14:08:54 +0000 (09:08 -0500)] 
Don't repeat package key with -dppr-debug when package info is missing.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Reviewed By: austin

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

4 years agorts/Linker.c: distinct between DATA and CODE labels when importing
Sergei Trofimovich [Tue, 7 Apr 2015 14:08:37 +0000 (09:08 -0500)] 
rts/Linker.c: distinct between DATA and CODE labels when importing

The patch is a last major piece to make unregisterised GHC build
under GCC's link-time optimizer.

Before the patch we imported everything external as functions.
Now we distinct between global variables and functions.

The difference is crucial on ia64 and a complement to fixes:
    > d82f592522eb8e063276a8a8c87ab93e18353c6b
    > CMM: add a mechanism to import C .data labels
    > e18525fae273f4c1ad8d6cbe1dea4fc074cac721
    > pprC: declare extern cmm primitives as functions, not data

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
Reviewed By: austin

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

4 years agoReplace endian test by 64-bit word access in T7600
Peter Trommler [Tue, 7 Apr 2015 14:08:29 +0000 (09:08 -0500)] 
Replace endian test by 64-bit word access in T7600

In commit 3f30912f an include `ghcconfig.h` was added for
`WORDS_BIGENDIAN`.

Converting the floating point array to a `Word64` array avoids
using the preprocessor altogether and leads to smaller code.

Fixes #10239

Reviewed By: rwbarton, austin

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

GHC Trac Issues: #10239

4 years agoLook inside synonyms for foralls when unifying
Simon Peyton Jones [Tue, 7 Apr 2015 13:45:04 +0000 (14:45 +0100)] 
Look inside synonyms for foralls when unifying

This fixes Trac #10194

4 years agoMore aggressive Given/Wanted overlap check
Simon Peyton Jones [Tue, 7 Apr 2015 13:29:10 +0000 (14:29 +0100)] 
More aggressive Given/Wanted overlap check

This fixes Trac #10195

For some reason we considered untouchability before, but Trac #10195
shows that this is positively worng.

See Note [Instance and Given overlap] in TcInteract.

Looking at the Git log, it seems that this bug was introduced at the
same time that we introduced the Given/Wanted overlap check in the first
place.

4 years agoPut quotes round a Name in an error message
Simon Peyton Jones [Tue, 7 Apr 2015 13:06:11 +0000 (14:06 +0100)] 
Put quotes round a Name in an error message

Cosmetic consistency only

4 years agoDo not quantify over the function itself in a RULE
Simon Peyton Jones [Tue, 7 Apr 2015 13:01:39 +0000 (14:01 +0100)] 
Do not quantify over the function itself in a RULE

We were erroneously quantifying over the function when it
had a dictionary type. A bit pathological, but possible.

This fixes Trac #10251

4 years agoGHC.Prim.Constraint is not built-in syntax
Simon Peyton Jones [Tue, 7 Apr 2015 12:55:43 +0000 (13:55 +0100)] 
GHC.Prim.Constraint is not built-in syntax

This fixes Trac #10233

4 years agoError msg wibbles from reduced module prefixes
Simon Peyton Jones [Tue, 7 Apr 2015 13:54:56 +0000 (14:54 +0100)] 
Error msg wibbles from reduced module prefixes

4 years agoReduce module qualifiers in pretty-printing
Simon Peyton Jones [Tue, 7 Apr 2015 12:48:30 +0000 (13:48 +0100)] 
Reduce module qualifiers in pretty-printing

The change is in HscTypes.mkPrintUnqualified, and suppresses the
module qualifier on Names from ghc-prim, base, and template-haskell,
where no ambiguity can aries.  It's somewhat arbitrary, but helps
with things like 'Constraint' which are often not in scope, but
occasionally show up in error messages.

4 years agoFix a long-standing bug in the demand analyser
Simon Peyton Jones [Mon, 6 Apr 2015 13:10:52 +0000 (14:10 +0100)] 
Fix a long-standing bug in the demand analyser

This patch fixes Trac #10148, an outright and egregious
bug in the demand analyser.

It is explained in Note [Demand on case-alternative binders]
in Demand.hs.

I did some other minor refactoring.

To my astonishment I got some big compiler perf changes

* perf/compiler/T5837: bytes allocated -76%
* perf/compiler/T5030: bytes allocated -10%
* perf/compiler/T3294: max bytes used  -25%

Happy days

4 years agoSuggest how to fix .ghci when it is group writeable (#8248)
Vikas Menon [Tue, 7 Apr 2015 13:39:44 +0000 (15:39 +0200)] 
Suggest how to fix .ghci when it is group writeable (#8248)

```
chmod 664 $PATH_TO_GHCI_CONF/.ghci
```

Run ghci. You will now get a warning + a suggestion:

```
  *** WARNING: $PATH_TO_GHCI_CONF/.ghci is writable by someone else, IGNORING!
  Suggested fix: execute 'chmod 644 $PATH_TO_GHCI_CONF/.ghci'
```

Execute fix and the warning should disappear.

Reviewed By: mboes, thomie

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

4 years agotestdriver: delete unused ways
Thomas Miedema [Tue, 7 Apr 2015 09:50:11 +0000 (11:50 +0200)] 
testdriver: delete unused ways

And mention more prominently that `-DDEBUG` and tests that call
`compiler_stats_num_fields` don't play well together

Reviewed By: austin

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

4 years agoTypechecker: refactoring only
Thomas Miedema [Tue, 7 Apr 2015 09:48:35 +0000 (11:48 +0200)] 
Typechecker: refactoring only

* don't call `nlHsPar`, as `genOpApp` already does so.
* don't reimplement `isUnboxedTupleTyCon` and `isBoxedTupleTyCon`.

Reviewed By: austin

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

4 years agoAdd -n to the RTS help output
Simon Marlow [Thu, 26 Mar 2015 08:47:04 +0000 (08:47 +0000)] 
Add -n to the RTS help output

4 years agoAdd +RTS -O<size> to control the minimum old gen size
Simon Marlow [Tue, 24 Mar 2015 14:20:58 +0000 (14:20 +0000)] 
Add +RTS -O<size> to control the minimum old gen size

4 years agoReplace hooks by callbacks in RtsConfig (#8785)
Simon Marlow [Mon, 9 Jun 2014 08:18:12 +0000 (09:18 +0100)] 
Replace hooks by callbacks in RtsConfig (#8785)

Summary:
Hooks rely on static linking semantics, and are broken by -Bsymbolic
which we need when using dynamic linking.

Test Plan: Built it

Reviewers: austin, hvr, tibbe

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

4 years agofix typo
Javran Cheng [Mon, 6 Apr 2015 11:36:21 +0000 (13:36 +0200)] 
fix typo

[skip ci]

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

4 years agofix '&stg_interp_constr_entry' FFI type to be FunPtr
Sergei Trofimovich [Mon, 6 Apr 2015 10:16:30 +0000 (11:16 +0100)] 
fix '&stg_interp_constr_entry' FFI type to be FunPtr

Summary:
It used to be Ptr, which is slightly incorrect.
ia64 has different representations for those types.

Found when tried to build unregisterised ghc with -flto,
GCC's link-time optimisation which happens to check
data / code declaration inconsistencies.

It our case 'stg_interp_constr_entry' is an RTS function:
   StgFunPtr f (StgFunPtr)
while '"&f" :: Ptr()' produces
   StgWordArray f[];

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
Reviewers: simonmar, hvr, austin

Reviewed By: austin

Subscribers: thomie

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

4 years agoStop profiling output from running together (#8811)
Dave Laing [Mon, 6 Apr 2015 10:10:29 +0000 (12:10 +0200)] 
Stop profiling output from running together (#8811)

Reviewed By: thomie

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

4 years agoUser's guide: .a files can be 2-2.5x larger with -split-objs
Thomas Miedema [Mon, 6 Apr 2015 09:51:34 +0000 (11:51 +0200)] 
User's guide: .a files can be 2-2.5x larger with -split-objs

And remove warning. This feature is available through cabal even.

Reviewed By: austin

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

4 years agoTest case for #10246
Joachim Breitner [Mon, 6 Apr 2015 07:37:42 +0000 (09:37 +0200)] 
Test case for #10246

still marked known_broken. This also adds the test case for #10245,
which should pass once #10246 is fixed.

4 years agoCmmSwitch: Do not trip over a case with no (valid) branches
Joachim Breitner [Sun, 5 Apr 2015 20:50:42 +0000 (22:50 +0200)] 
CmmSwitch: Do not trip over a case with no (valid) branches

This fixes #10245. I did not commit the test case, as it fails
unconditionally with a compiler built with -DDEBUG, so maybe it is bogus
Haskell anyways.

4 years agoUpdate hsc2hs submodule
Reid Barton [Sun, 5 Apr 2015 19:59:14 +0000 (15:59 -0400)] 
Update hsc2hs submodule

4 years agoWhitespace only
Reid Barton [Sun, 5 Apr 2015 19:33:35 +0000 (15:33 -0400)] 
Whitespace only

4 years agotestsuite: skip T10017 on Windows
Austin Seipp [Fri, 3 Apr 2015 11:33:26 +0000 (06:33 -0500)] 
testsuite: skip T10017 on Windows

Signed-off-by: Austin Seipp <austin@well-typed.com>
4 years agorts/linker: make an error msg a debug msg
Austin Seipp [Fri, 3 Apr 2015 11:12:35 +0000 (06:12 -0500)] 
rts/linker: make an error msg a debug msg

This fixes more testsuite failures on Windows.

Signed-off-by: Austin Seipp <austin@well-typed.com>
4 years agotestsuite: fix failing amd64/Windows perf tests
Austin Seipp [Fri, 3 Apr 2015 10:59:57 +0000 (05:59 -0500)] 
testsuite: fix failing amd64/Windows perf tests

Signed-off-by: Austin Seipp <austin@well-typed.com>
4 years agoComments only, mostly typos
Thomas Miedema [Fri, 3 Apr 2015 15:58:53 +0000 (17:58 +0200)] 
Comments only, mostly typos

[skip ci]

4 years agoDon't `make accept` output of `expect_broken_for` tests
Thomas Miedema [Fri, 3 Apr 2015 12:01:15 +0000 (14:01 +0200)] 
Don't `make accept` output of `expect_broken_for` tests

This is a followup to d4cf7051bc17182238b17ba1dc42e190fa5c6f0d, which
did the same for `expect_broken` tests.

Reviewed By: austin

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

4 years agoRemove an incorrect statement about -fwarn-tabs
Dave Laing [Fri, 3 Apr 2015 05:49:38 +0000 (00:49 -0500)] 
Remove an incorrect statement about -fwarn-tabs

Reviewed By: austin

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

GHC Trac Issues: #10213

4 years agoData.Complex: Derive Generic
Ben Gamari [Fri, 3 Apr 2015 05:48:51 +0000 (00:48 -0500)] 
Data.Complex: Derive Generic

Reviewed By: hvr, austin

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

4 years agoparser: allow type-level cons in prefix position
Kinokkory [Fri, 3 Apr 2015 05:47:15 +0000 (00:47 -0500)] 
parser: allow type-level cons in prefix position

Reviewed By: austin

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

GHC Trac Issues: #10188

4 years agoRestore unwind information generation
Peter Wortmann [Fri, 3 Apr 2015 05:23:56 +0000 (00:23 -0500)] 
Restore unwind information generation

While we want to reduce the amount of information generated into
debug_info, it really doesn't make sense to remove block information
for unwinding.

This is a simple oversight introduced in 4ab57024, which severly
reduces the usefulness of generated unwind data. Thanks to bitonic
for spotting this!

Reviewed By: austin

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

GHC Trac Issues: #10236

4 years agodocs: remove unused -ddump flags from users guide
Javran Cheng [Fri, 3 Apr 2015 05:24:06 +0000 (00:24 -0500)] 
docs: remove unused -ddump flags from users guide

According to https://phabricator.haskell.org/rGHC6e771fa19dbb7edc116b5974124229a2725103e8

Reviewed By: austin

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

4 years agoclarify --no-as-needed is only needed on ELF
Peter Trommler [Fri, 3 Apr 2015 05:22:59 +0000 (00:22 -0500)] 
clarify --no-as-needed is only needed on ELF

From the code it was not clear that `--no-as-needed` was not necessary
on Windows. Add this fact and describe the fix for #10110 in a separate
note.

See audit for rGHC1b7f59769052fd8193c6acc561216e070d0ca335 raised
by @thomie.

Reviewed By: thomie

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

GHC Trac Issues: #10110

4 years agoFix validate linenumber off-by-one
Thomas Miedema [Thu, 2 Apr 2015 22:19:15 +0000 (00:19 +0200)] 
Fix validate linenumber off-by-one

4 years agolibffi: backport noexecstack fix for x86/win32.S
Sergei Trofimovich [Thu, 2 Apr 2015 21:02:57 +0000 (22:02 +0100)] 
libffi: backport noexecstack fix for x86/win32.S

Got detected by gentoo's QA preinstall hook:
 * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so.6.0.2
 * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so
 * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so.6
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_p.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_l.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_debug.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_debug.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_l.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_p.a:win32.o

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
Test Plan: built ghc-7.10.1 binary and checked stacks as NX

Reviewers: rwbarton, hvr, austin

Reviewed By: austin

Subscribers: thomie

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

GHC Trac Issues: #10208

4 years agoChange 'Tab character' warnings so there is one per file (#9723)
Dave Laing [Thu, 2 Apr 2015 16:51:46 +0000 (18:51 +0200)] 
Change 'Tab character' warnings so there is one per file (#9723)

Reviewed By: nomeata, thomie

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

Signed-off-by: Dave Laing <dave.laing.80@gmail.com>
4 years agoDisable same warnings for normal builds as for validate (#10223)
Thomas Miedema [Thu, 2 Apr 2015 09:41:47 +0000 (11:41 +0200)] 
Disable same warnings for normal builds as for validate (#10223)

The default validate settings currently disable some warnings in the
libraries. This patch moves those settings to a new file called
`mk/warnings.mk`, and applies them also to normal builds.

Through uncommenting a line in build.mk, developers can now build with
-Werror.

-Werror is not the default, because:
* We can not guarantee that the build is warning free on platforms we
  don't run regularly run validate (as part of continuous integration
  systems), and we still want the build to go through on those
  platforms.
* quoting rwbarton on irc > "I think -Werror by default has come up in
  the past and the argument was that it is too annoying when you are
  doing nontrivial development"

Reviewed By: austin

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

4 years agoDo not set -fasm explicitly in build.mk.sample (#10223)
Thomas Miedema [Thu, 2 Apr 2015 09:39:54 +0000 (11:39 +0200)] 
Do not set -fasm explicitly in build.mk.sample (#10223)

On platforms that support -fasm, it is already the default, so we don't
have to set it.

Reviewed By: austin, erikd (tested on powerpc and armhf)

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

4 years agoFake (->) fixity declaration (#10145)
Oleg Grenrus [Thu, 2 Apr 2015 09:28:03 +0000 (11:28 +0200)] 
Fake (->) fixity declaration (#10145)

Reviewed By: simonpj, austin

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

4 years agoIndentation only.
Edward Z. Yang [Sun, 29 Mar 2015 05:34:32 +0000 (22:34 -0700)] 
Indentation only.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
4 years agoFilter out `-Rghc-timing` for V=0 builds (#10223)
Thomas Miedema [Wed, 1 Apr 2015 17:30:16 +0000 (19:30 +0200)] 
Filter out `-Rghc-timing` for V=0 builds (#10223)

Reviewed By: austin

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

4 years agoReformat build flavours in build.mk.sample (#10223)
Thomas Miedema [Wed, 1 Apr 2015 17:24:13 +0000 (19:24 +0200)] 
Reformat build flavours in build.mk.sample (#10223)

Use same format for each build flavour, to make it easier to compare
them. Refactoring only.

Reviewed By: austin

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

4 years agoChange which files --make thinks are 'Haskellish' (#10220)
Thomas Miedema [Wed, 1 Apr 2015 17:22:28 +0000 (19:22 +0200)] 
Change which files --make thinks are 'Haskellish' (#10220)

`.hspp` and `.hscpp` are haskell files that have already been preprocessed.

Treat `.hspp` and `.hscpp` as Haskellish sources again, as they were before
commit a10e1990. This way, ghc --make will load their imports.

Make sure that `.cmm` and `.cmmcpp` are still not treated as Haskellish,
by moving them out of `haskell_src_suffixes` (but still keeping them in
haskellish_suffixes, though I'm not sure what the purpose of that group
is).

Reviewed By: austin

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

4 years agoDon't `make accept` output of expect_broken tests
Thomas Miedema [Wed, 1 Apr 2015 15:28:39 +0000 (17:28 +0200)] 
Don't `make accept` output of expect_broken tests

When running `make accept` on a directory in the testsuite, don't accept
the output of tests that are marked as expect_broken. This makes it
easier to review `git diff` after running `make accept`.

When you change an error message in the compiler that shows up in the
output of many tests, you can run `make accept` in the testsuite
directory, and all expected test output will be updated. But since your
change didn't magically fix all the other bugs in the compiler for which
we have an expect_broken test, the output for those tests should
probably not be updated.

Before, the effect of running `make accept` could be that some tests
would end up in the 'unexpected passes' group.

[skip ci]

Reviewed By: austin

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

4 years agouBackpack: simplified Backpack description.
Edward Z. Yang [Tue, 24 Mar 2015 19:28:16 +0000 (12:28 -0700)] 
uBackpack: simplified Backpack description.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
4 years agoTestsuite: redirect stderr to /dev/null when running GS on bad.ps
Thomas Miedema [Tue, 31 Mar 2015 12:12:52 +0000 (14:12 +0200)] 
Testsuite: redirect stderr to /dev/null when running GS on bad.ps

This is a followup to a3d0a7a0ba3a1ee458a9883011247561dfe22f4a.

Reviewed by: Rufflewind

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

4 years agoDon't treat .hcr and .raw_s as haskellish suffixes
Thomas Miedema [Tue, 31 Mar 2015 10:15:34 +0000 (12:15 +0200)] 
Don't treat .hcr and .raw_s as haskellish suffixes

.hcr: external core
.raw_s: direct output from the c compiler, back in the day

Reviewed By: austin

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

4 years agoDon't throw exception when start_phase==stop_phase (#10219)
Thomas Miedema [Tue, 31 Mar 2015 10:12:24 +0000 (12:12 +0200)] 
Don't throw exception when start_phase==stop_phase (#10219)

Just do nothing instead. This bug only shows up when using `-x hspp` in
--make mode on registerised builds.

Reviewed By: austin

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

4 years agoExplicitly check for -C on registerised build (#7563)
Thomas Miedema [Tue, 31 Mar 2015 10:11:08 +0000 (12:11 +0200)] 
Explicitly check for -C on registerised build (#7563)

Show a more descriptive error message.

Reviewed By: austin

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

4 years agoTestsuite: suppress errors when running GS on bad.ps
Phil Ruffwind [Tue, 31 Mar 2015 10:04:50 +0000 (12:04 +0200)] 
Testsuite: suppress errors when running GS on bad.ps

Suppress the errors that appear in standard output when running gs on
bad.ps since it's expected to fail anyway.

Reviewed By: thomie, austin

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