1. 02 Nov, 2018 2 commits
    • Richard Eisenberg's avatar
      Don't lint erroneous programs. · 41f0f6c2
      Richard Eisenberg authored
      newFamInst lints its types. This is good. But it's not so good
      when there have been errors and thus recovery tycons are about.
      So we now don't.
      Fixes #15796.
      Test case: typecheck/should_fail/T15796
      (cherry picked from commit 1f72a1c8)
    • Richard Eisenberg's avatar
      Fix #15787 by squashing a coercion hole. · 7a439e7b
      Richard Eisenberg authored
      In type-incorrect code, we can sometimes let a coercion
      hole make it through the zonker. If this coercion hole then
      ends up in the environment (e.g., in the type of a data
      constructor), then it causes trouble later.
      This patch avoids trouble by substituting the coercion hole
      for its representative CoVar. Really, any coercion would do,
      but the CoVar was very handy.
      test case: polykinds/T15787
      (cherry picked from commit 4427315a)
  2. 31 Oct, 2018 1 commit
  3. 30 Oct, 2018 6 commits
    • Ben Gamari's avatar
      users-guide: Note existence of #14251 · a876edcb
      Ben Gamari authored
    • Ryan Scott's avatar
      Fix #15815 by parenthesizing the arguments to infix ~ · 2567e8f3
      Ryan Scott authored
      An unfortunate consequence of commit
      b9483981 (`Remove HsEqTy and XEqTy`)
      is infix uses of `~` in TH quotes now desugar differently than
      before. In particular, we have that:
      a ~ (Int -> Int)
      Now desugars to:
      HsOpTy a (~) (HsOpTy Int (->) Int)
      Which GHC interprets as being:
      a ~ Int -> Int
      Or, equivalently:
      (a ~ Int) -> Int
      Which is different than what was intended! This is the cause
      of #15815.
      All of this has revealed that we likely need to renovate the way we
      desugar infix type operators to be more consistent with the treatment
      for infix expressions (see
      https://ghc.haskell.org/trac/ghc/ticket/15815#comment:5 for more on
      this.) Doing so would constitute a breaking change, however, so we
      will likely want to wait until another major GHC release to do this.
      In the meantime, this patch offers a non-invasive change to the way
      that infix uses of `~` are desugared. This makes the program
      in #15815 compile again by inserting extra `HsParTy`s around the
      arguments to `~` if they are lacking them.
      Test Plan: make test TEST=T15815
      Reviewers: int-index, goldfire, bgamari
      Reviewed By: int-index
      Subscribers: int-e, rwbarton, carter
      GHC Trac Issues: #15815
      Differential Revision: https://phabricator.haskell.org/D5274
      (cherry picked from commit b8a797ec)
    • Ben Gamari's avatar
      Revert "Multiple fixes / improvements for LLVM backend" · 377fe398
      Ben Gamari authored
      This reverts commit 73273be4.
      Unfortunately we were unable to come to a fix that didn't sacrifice the
      ability to bootstrap GHC using the LLVM backend. Reverting for 8.6.2.
    • Ben Gamari's avatar
      Revert "Fix for T14251 on ARM" · 9c4314ec
      Ben Gamari authored
      This reverts commit 2e23e1c7.
    • Ben Gamari's avatar
      users-guide: Fix typo · d67cbced
      Ben Gamari authored
    • Simon Peyton Jones's avatar
      Report a Wanted error even if there are Given ones · a49f95c2
      Simon Peyton Jones authored
      We suppress some Given errors; see Note [Given errors]
      in TcErrors.  But we must be careful not to suppress
      Wanted errors because of the presence of these Given
      errors -- else we might allow compilation to bogusly
      The rubber hits the road in TcRnTypes.insolubleCt,
      where we don't want to treat Givens as insoluble,
      nor (and this is the new bit) Deriveds that arise
      from Givens.  See Note [Given insolubles] in TcRnTypes.
      This fixes #15767.
      (cherry picked from commit 6b1102e2)
      Ben notes:
        I have folded some test output changes in `TEST="T12529 T12921 mc13
        mc14"` into this patch that were not in the original.
  4. 28 Oct, 2018 9 commits
    • Ningning Xie's avatar
      Fix TcType.anyRewritableTyVar · b391cae1
      Ningning Xie authored
      This patch fixes #15805, where we found that
      `TcType.anyRewritableTyVar` has one wrong case.
      Besides the fix, it also:
      - removed some unnecessary `ASSERT2(tcIsTcTyVar...)` in `TcType`, as now we have
           `tcIsTcTyVar = isTyVar`.
      - fixed some comments
      Test Plan: ./validate
      Reviewers: goldfire, simonpj, bgamari
      Reviewed By: simonpj
      Subscribers: rwbarton, carter
      GHC Trac Issues: #15805
      Differential Revision: https://phabricator.haskell.org/D5263
      (cherry picked from commit a7f64c6c)
    • Ben Gamari's avatar
      users-guide: Add release notes for 8.6.2 · 9f802777
      Ben Gamari authored
    • sheaf's avatar
      plugins: search for .a files if necessary · d2cd150e
      sheaf authored
      on windows, plugins are loaded via .a files,
      but those paths were not being searched when loading plugins
      Test Plan: ./validate
      Reviewers: Phyx, bgamari
      Reviewed By: Phyx
      Subscribers: RyanGlScott, rwbarton, carter
      GHC Trac Issues: #15700
      Differential Revision: https://phabricator.haskell.org/D5253
      (cherry picked from commit 70298db16c3f0ea4adb603ccb2b5e93eb9c7a556)
    • Christiaan Baaij's avatar
      Comment out CONSTANT_FOLDED in GHC.Natural · de9a8feb
      Christiaan Baaij authored
      Although these functions were marked as CONSTANT_FOLDED, they did
      not have a corresponding builtinRule in PrelRules. The idea was
      probably to add them eventually, but this hasn't manifested so
      The plan is to eventually add builtin rules for these functions
      over Natural, so as a reminder we simply comment out the
      CONSTANT_FOLDED  annotation instead of removing it completely.
      Reviewers: hvr, bgamari
      Reviewed By: bgamari
      Subscribers: rwbarton, carter
      Differential Revision: https://phabricator.haskell.org/D5267
      (cherry picked from commit 3ec6fe8827956cc36b58cdf0bb1f5752eaa2a8ea)
    • Fangyi Zhou's avatar
      Fix integer overflow when encoding doubles (Trac #15271) · 37d14601
      Fangyi Zhou authored
      Ticket #15271 reports a case where 1e1000000000 is incorrectly
      converted to 0.0. After some investigation, I discovered the number is
      converted to rational correctly, but converting the ratio into a double
      introduced an error.
      Tracking down to how the conversion is done, I found the rts float
      implementation uses `ldexp`, whose signature is
      `double ldexp (double x, int exp);`
      The callsite passes an `I_` to the second argument, which is
      platform-dependent. On machines where `I_` is 64 bits and `int` is 32 bits, we
      observe integer overflow behaviour.
      Here is a mapping from rational to exponent with observations
      1e646457008  -> 2147483645 (result = infinity, positive in int32)
      1e646457009  -> 2147483648 (result = 0.0, overflow to negative in int32)
      1e1000000000 -> 3321928042 (result = infinity, overflow to positive in int32)
      1e1555550000 -> 5167425196 (result = 0.0, overflow to negative in int32)
      We fix this issue by comparing STG_INT_MIN/MAX and INT_MIN/MAX and bound the
      value appropriately.
      Test Plan: New test cases
      Reviewers: bgamari, erikd, simonmar
      Reviewed By: bgamari
      Subscribers: rwbarton, carter
      GHC Trac Issues: #15271
      Differential Revision: https://phabricator.haskell.org/D5271
      (cherry picked from commit 311a63979cfa2c1e81be54b82205e681f6ec4f14)
    • Ningning Xie's avatar
      Fix `:k` command: add validity checking · 804518f7
      Ningning Xie authored
      This patch fixes #15806, where we found that the `:k` command in GHCi
      misses a validity checking for the type.
      Missing validity checking causes `:k` to accept types that are not validated.
      For example, `:k (Maybe (forall a. a -> a))` (incorrectly) returns `*`, while
      impredictivity of type instantiation shouldn't be allowed.
      Test Plan: ./validate
      Reviewers: simonpj, goldfire, bgamari
      Reviewed By: bgamari
      Subscribers: rwbarton, carter
      GHC Trac Issues: #15806
      Differential Revision: https://phabricator.haskell.org/D5265
      (cherry picked from commit 12cb5cf50b8b35394e2e2d57e1ac693c76f90833)
    • Ben Gamari's avatar
      includes: Allow headers to be built with C++11 compilers · b539a99c
      Ben Gamari authored
      Fixes #14784. Note that C++11 is quite conservative; we could likely accept
      C++03 as well.
      Test Plan:
      $ cat >hi.c <<EOF
      #include <Rts.h>
      $ g++ -std=c++11 hi.c
      Reviewers: simonmar, hvr
      Subscribers: rwbarton, carter
      GHC Trac Issues: #14784
      Differential Revision: https://phabricator.haskell.org/D5244
      (cherry picked from commit d3a1022fabb0ad337003fac774c6929f402ecb8b)
    • Zejun Wu's avatar
      Fix rare undefined asm temp end label error in x86 · 38618f74
      Zejun Wu authored
      Encountered assembly error due to undefined label `.LcaDcU_info_end` for
      following code generated by `pprFrameProc`:
        .long .Lblock{v caDcU}_info_fde_end-.Lblock{v caDcU}_info_fde
      .Lblock{v caDcU}_info_fde:
        .long _nbHlD-.Lsection_frame
        .quad block{v caDcU}_info-1
        .quad .Lblock{v caDcU}_info_end-block{v caDcU}_info+1
        .byte 1
      This diff fixed the error.
      Test Plan:
      Also the case where we used to have assembly error is now fixed.
      Unfortunately, I have limited insight here and cannot get a small enough repro
      or test case for this.
      Ben says:
      > I think I see: Previously we only produced end symbols for the info
      > tables of top-level procedures. However, blocks within a procedure may
      > also have info tables, we will dutifully generate debug information for
      > and consequently we get undefined symbols.
      Reviewers: simonmar, scpmw, last_g, bgamari
      Reviewed By: bgamari
      Subscribers: rwbarton, carter
      Differential Revision: https://phabricator.haskell.org/D5246
      (cherry picked from commit cf961dcf5ebc26cbd960196ba387736334088303)
    • Kavon Farvardin's avatar
      Fix for T14251 on ARM · 2e23e1c7
      Kavon Farvardin authored
      We now calculate the SSE register padding needed to fix the calling
      convention in LLVM in a robust way: grouping them by whether
      registers in that class overlap (with the same class overlapping
      My prior patch assumed that no matter the platform, physical
      register Fx aliases with Dx, etc, for our calling convention.
      This is unfortunately not the case for any platform except x86-64.
      Test Plan:
      Only know how to test on x86-64, but it should be tested on ARM with:
      `make test WAYS=llvm && make test WAYS=optllvm`
      Reviewers: bgamari, angerman
      Reviewed By: bgamari
      Subscribers: rwbarton, carter
      GHC Trac Issues: #15780, #14251, #15747
      Differential Revision: https://phabricator.haskell.org/D5254
      (cherry picked from commit c36a2b596a6ba9d7a0a80df01b3c041720c727ca)
  5. 24 Oct, 2018 1 commit
  6. 17 Oct, 2018 5 commits
  7. 16 Oct, 2018 1 commit
    • Ben Gamari's avatar
      base: Fill in TBAs in changelog · f7b1ee96
      Ben Gamari authored
      I've added a check in my release script to ensure that this doesn't happen in
      the future.
      (cherry picked from commit 2605458930f2d79738fab4437f10793448d4232c)
  8. 13 Oct, 2018 9 commits
    • Ömer Sinan Ağacan's avatar
      Fix dataToTag# argument evaluation · b11126fc
      Ömer Sinan Ağacan authored
      See #15696 for more details. We now always enter dataToTag# argument (done in
      generated Cmm, in StgCmmExpr). Any high-level optimisations on dataToTag#
      applications are done by the simplifier. Looking at tag bits (instead of
      reading the info table) for small types is left to another diff.
      Incorrect test T14626 is removed. We no longer do this optimisation (see
      comment:44, comment:45, comment:60).
      Comments and notes about special cases around dataToTag# are removed. We no
      longer have any special cases around it in Core.
      Other changes related to evaluating primops (seq# and dataToTag#) will be
      pursued in follow-up diffs.
      Test Plan: Validates with three regression tests
      Reviewers: simonpj, simonmar, hvr, bgamari, dfeuer
      Reviewed By: simonmar
      Subscribers: rwbarton, carter
      GHC Trac Issues: #15696
      Differential Revision: https://phabricator.haskell.org/D5201
      (cherry picked from commit ac977688)
    • Simon Peyton Jones's avatar
      Do not mark CoVars as dead in the occur-anal · a22ee705
      Simon Peyton Jones authored
      For years we have been marking CoVars as dead, becuase we
      don't gather occurrence info from types.  This is obviously
      wrong and caused Trac #15695.
      See Note [Do not mark CoVars as dead] in OccurAnal.
      (cherry picked from commit 02b303ee)
    • Simon Marlow's avatar
      Fix for recover with -fexternal-interpreter (#15418) · a04ecd7b
      Simon Marlow authored
      When using -fexternal-interpreter, recover was not treating a Q
      compuation that simply registered an error with addErrTc as failing.
      Test Plan:
      New unit tests:
      * T15418 is the repro from in the ticket
      * TH_recover_warns is a new test to ensure that we're keeping warnings when
        the body of recover succeeds.
      Reviewers: bgamari, RyanGlScott, angerman, goldfire, erikd
      Subscribers: rwbarton, carter
      GHC Trac Issues: #15418
      Differential Revision: https://phabricator.haskell.org/D5185
      (cherry picked from commit d00c3086)
    • Alec Theriault's avatar
      GHCi should not filter instances involving cTuples · 51c44793
      Alec Theriault authored
      Summary: See the new T12005 test case for an example of this.
      Test Plan: make TEST=T12005
      Reviewers: bgamari, osa1
      Reviewed By: osa1
      Subscribers: osa1, rwbarton, carter
      GHC Trac Issues: #12005
      Differential Revision: https://phabricator.haskell.org/D5182
      (cherry picked from commit 21efbc75)
    • Vladislav Zavialov's avatar
      Add -Wstar-is-type to the User's Guide · 4ab2f347
      Vladislav Zavialov authored
      The -Wstar-is-type flag was added without documentation.
      Now it has documentation.
      Test Plan: Validate
      Reviewers: bgamari
      Reviewed By: bgamari
      Subscribers: rwbarton, carter
      Differential Revision: https://phabricator.haskell.org/D5203
      (cherry picked from commit 07083fc4)
    • Ömer Sinan Ağacan's avatar
      Fix slop zeroing for AP_STACK eager blackholes in debug build · 10e3125d
      Ömer Sinan Ağacan authored
      As #15571 reports, eager blackholing breaks sanity checks as we can't
      zero the payload when eagerly blackholing (because we'll be using the
      payload after blackholing), but by the time we blackhole a previously
      eagerly blackholed object (in `threadPaused()`) we don't have the
      correct size information for the object (because the object's type
      becomes BLACKHOLE when we eagerly blackhole it) so can't properly zero
      the slop.
      This problem can be solved for AP_STACK eager blackholing (which unlike
      eager blackholing in general, is not optional) by zeroing the payload
      after entering the stack. This patch implements this idea.
      Fixes #15571.
      Test Plan:
      Previously concprog001 when compiled and run with sanity checks
          ghc-stage2 Mult.hs -debug -rtsopts
          ./Mult +RTS -DS
      was failing with
          Mult: internal error: checkClosure: stack frame
              (GHC version 8.7.20180821 for x86_64_unknown_linux)
              Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
      thic patch fixes this panic. The test still panics, but it runs for a while
      before panicking (instead of directly panicking as before), and the new problem
      seems unrelated:
          Mult: internal error: ASSERTION FAILED: file rts/sm/Sanity.c, line 296
              (GHC version 8.7.20180919 for x86_64_unknown_linux)
              Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
      The new problem will be fixed in another diff.
      I also tried slow validate (which requires D5164): this does not introduce any
      new failures.
      Reviewers: simonmar, bgamari, erikd
      Reviewed By: simonmar
      Subscribers: rwbarton, carter
      GHC Trac Issues: #15571
      Differential Revision: https://phabricator.haskell.org/D5165
      (cherry picked from commit 66c17293)
    • Roland Senn's avatar
      Compiler panic on invalid syntax (unterminated pragma) · 52304776
      Roland Senn authored
      Summary: After a parse error in OPTIONS_GHC issue an error message instead of a compiler panic.
      Test Plan: make test TEST=T15053
      Reviewers: Phyx, thomie, bgamari, monoidal, osa1
      Reviewed By: Phyx, monoidal, osa1
      Subscribers: tdammers, osa1, rwbarton, carter
      GHC Trac Issues: #15053
      Differential Revision: https://phabricator.haskell.org/D5093
      (cherry picked from commit df363a64)
    • Ben Gamari's avatar
      testsuite: Add test for #15053 · 377975e0
      Ben Gamari authored
      Reviewers: Phyx
      Reviewed By: Phyx
      Subscribers: Phyx, rwbarton, thomie, carter
      GHC Trac Issues: #15053
      Differential Revision: https://phabricator.haskell.org/D4883
      (cherry picked from commit f03f0d61)
    • Alec Theriault's avatar
      Don't show constraint tuples in errors (#14907) · 87266ea7
      Alec Theriault authored
      This means that 'GHC.Classes.(%,%)' is no longer mentioned in
      error messages for things like
         class (a,b,c)  -- outside of 'GHC.Classes'
         class (a,Bool)
      Test Plan: make TEST=T14907a && make TEST=T14907b
      Reviewers: RyanGlScott, bgamari
      Reviewed By: RyanGlScott
      Subscribers: rwbarton, carter
      GHC Trac Issues: #14907
      Differential Revision: https://phabricator.haskell.org/D5172
      (cherry picked from commit 9bfbc4e1)
  9. 07 Oct, 2018 1 commit
  10. 05 Oct, 2018 5 commits
    • Ryan Scott's avatar
      Be mindful of GADT tyvar order when desugaring record updates · 0af55c12
      Ryan Scott authored
      After commit ef26182e,
      the type variable binders in GADT constructor type signatures
      are now quantified in toposorted order, instead of always having
      all the universals before all the existentials. Unfortunately, that
      commit forgot to update some code (which was assuming the latter
      scenario) in `DsExpr` which desugars record updates. This wound
      up being the cause of #15499.
      This patch makes up for lost time by desugaring record updates in
      a way such that the desugared expression applies type arguments to
      the right-hand side constructor in the correct order—that is, the
      order in which they were quantified by the user.
      Test Plan: make test TEST=T15499
      Reviewers: simonpj, bgamari
      Reviewed By: simonpj
      Subscribers: rwbarton, carter
      GHC Trac Issues: #15499
      Differential Revision: https://phabricator.haskell.org/D5060
      (cherry picked from commit 63b6a1d4)
    • Tamar Christina's avatar
      Drop accidental write-attributes request · a2e3334c
      Tamar Christina authored
      The new filesystem code accidentally asks for write attributes
      permissions when doing read-only access.
      I believe this is what's causing the GHC 8.6.1 tarballs to fail
      when installed to a privileged location.
      I haven't been able to reproduce the issue yet, but this permission
      bit is wrong anyway.
      Test Plan: I'm still trying to workout how to test that this works,
      changing the permissions on the folder doesn't seem to reproduce
      the error on a tarball I made from before the change.
      Reviewers: bgamari, tdammers
      Reviewed By: bgamari
      Subscribers: tdammers, monoidal, rwbarton, carter
      GHC Trac Issues: #15667
      Differential Revision: https://phabricator.haskell.org/D5177
      (cherry picked from commit deceb21b)
    • Ben Gamari's avatar
      Bump array submodule · bf256ef2
      Ben Gamari authored
    • Kavon Farvardin's avatar
      Multiple fixes / improvements for LLVM backend · 73273be4
      Kavon Farvardin authored
      - Fix for #13904 -- stop "trashing" callee-saved registers, since it is
        not actually doing anything useful.
      - Fix for #14251 -- fixes the calling convention for functions passing
        raw SSE-register values by adding padding as needed to get the values
        in the right registers. This problem cropped up when some args were
        unused an dropped from the live list.
      - Fixed a typo in 'readnone' attribute
      - Added 'lower-expect' pass to level 0 LLVM optimization passes to
        improve block layout in LLVM for stack checks, etc.
      Test Plan: `make test WAYS=optllvm` and `make test WAYS=llvm`
      Reviewers: bgamari, simonmar, angerman
      Reviewed By: angerman
      Subscribers: rwbarton, carter
      GHC Trac Issues: #13904, #14251
      Differential Revision: https://phabricator.haskell.org/D5190
      (cherry picked from commit adcb5fb4)
    • Ben Gamari's avatar
      testsuite: Don't force run of llvm ways in T14251 · 4338398f
      Ben Gamari authored
      This breaks if LLVM is not available.
      (cherry picked from commit d0d74842)