This project is mirrored from https://gitlab.haskell.org/ghc/ghc.git. Pull mirroring failed .
Repository mirroring has been paused due to too many failed attempts, and can be resumed by a project maintainer.
Last successful update .
  1. 07 Sep, 2018 7 commits
    • chris-bacon's avatar
      Fixed typo in exponent example · 95b7b0a0
      chris-bacon authored
      (cherry picked from commit 36c1431d)
      95b7b0a0
    • Andrey Mokhov's avatar
      Fix a constant folding rule · f6595773
      Andrey Mokhov authored
      Summary:
      One of the constant folding rules introduced in D2858 is:
      
      ```
      (L y :-:   v) :-: (L x :-: w) -> return $ mkL (y-x)   `add` (w `add` v)
      ```
      
      Or, after removing syntactic noise: `(y - v) - (x - w) ==> (y - x) + (w + v)`.
      This is incorrect, since the sign of `v` is changed from negative to positive.
      As a consequence, the following program prints `3` when compiled with `-O`:
      
      ```
      -- This is just subtraction in disguise
      minus :: Int -> Int -> Int
      minus x y = (8 - y) - (8 - x)
      {-# NOINLINE minus #-}
      
      main :: IO ()
      main = print (2 `minus` 1)
      ```
      
      The correct rule is: `(y - v) - (x - w) ==> (y - x) + (w - v)`.
      
      This commit does the fix. I haven't found any other issues with the constant
      folding code, but it's difficult to be certain without some automated checking.
      
      Reviewers: bgamari, tdammers
      
      Subscribers: hsyl20, tdammers, rwbarton, carter
      
      GHC Trac Issues: #15569
      
      Differential Revision: https://phabricator.haskell.org/D5109
      
      (cherry picked from commit 65eec9cf)
      f6595773
    • Krzysztof Gogolewski's avatar
      Fix typo in 8.6.1 notes · 21545666
      Krzysztof Gogolewski authored
      (cherry picked from commit 34b8e613)
      21545666
    • Ömer Sinan Ağacan's avatar
      Skip eventlog tests in GHCi way · aeb24707
      Ömer Sinan Ağacan authored
      Summary: (GHCi doesn't generate event logs)
      
      Test Plan:
      These tests were failing in GHCi way, they're now skipped in GHCi way as GHCi
      doesn't generate eventlogs
      
      Reviewers: bgamari, simonmar, maoe, alpmestan
      
      Reviewed By: alpmestan
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15587
      
      Differential Revision: https://phabricator.haskell.org/D5119
      
      (cherry picked from commit c0e5087d)
      aeb24707
    • Ömer Sinan Ağacan's avatar
      Fix a race between GC threads in concurrent scavenging · d46dd452
      Ömer Sinan Ağacan authored
      While debugging #15285 I realized that free block lists (free_list in
      BlockAlloc.c) get corrupted when multiple scavenge threads allocate and
      release blocks concurrently. Here's a picture of one such race:
      
          Thread 2 (Thread 32573.32601):
          #0  check_tail
              (bd=0x940d40 <stg_TSO_info>) at rts/sm/BlockAlloc.c:860
          #1  0x0000000000928ef7 in checkFreeListSanity
              () at rts/sm/BlockAlloc.c:896
          #2  0x0000000000928979 in freeGroup
              (p=0x7e998ce02880) at rts/sm/BlockAlloc.c:721
          #3  0x0000000000928a17 in freeChain
              (bd=0x7e998ce02880) at rts/sm/BlockAlloc.c:738
          #4  0x0000000000926911 in freeChain_sync
              (bd=0x7e998ce02880) at rts/sm/GCUtils.c:80
          #5  0x0000000000934720 in scavenge_capability_mut_lists
              (cap=0x1acae80) at rts/sm/Scav.c:1665
          #6  0x000000000092b411 in gcWorkerThread
              (cap=0x1acae80) at rts/sm/GC.c:1157
          #7  0x000000000090be9a in yieldCapability
              (pCap=0x7f9994e69e20, task=0x7e9984000b70, gcAllowed=true) at rts/Capability.c:861
          #8  0x0000000000906120 in scheduleYield
              (pcap=0x7f9994e69e50, task=0x7e9984000b70) at rts/Schedule.c:673
          #9  0x0000000000905500 in schedule
              (initialCapability=0x1acae80, task=0x7e9984000b70) at rts/Schedule.c:293
          #10 0x0000000000908d4f in scheduleWorker
              (cap=0x1acae80, task=0x7e9984000b70) at rts/Schedule.c:2554
          #11 0x000000000091a30a in workerStart
              (task=0x7e9984000b70) at rts/Task.c:444
          #12 0x00007f99937fa6db in start_thread
              (arg=0x7f9994e6a700) at pthread_create.c:463
          #13 0x000061654d59f88f in clone
              () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      
          Thread 1 (Thread 32573.32573):
          #0  checkFreeListSanity
              () at rts/sm/BlockAlloc.c:887
          #1  0x0000000000928979 in freeGroup
              (p=0x7e998d303540) at rts/sm/BlockAlloc.c:721
          #2  0x0000000000926f23 in todo_block_full
              (size=513, ws=0x1aa8ce0) at rts/sm/GCUtils.c:264
          #3  0x00000000009583b9 in alloc_for_copy
              (size=513, gen_no=0) at rts/sm/Evac.c:80
          #4  0x000000000095850d in copy_tag_nolock
              (p=0x7e998c675f28, info=0x421d98 <Main_Large_con_info>, src=0x7e998d075d80, size=513,
              gen_no=0, tag=1) at rts/sm/Evac.c:153
          #5  0x0000000000959177 in evacuate
              (p=0x7e998c675f28) at rts/sm/Evac.c:715
          #6  0x0000000000932388 in scavenge_small_bitmap
              (p=0x7e998c675f28, size=1, bitmap=0) at rts/sm/Scav.c:271
          #7  0x0000000000934aaf in scavenge_stack
              (p=0x7e998c675f28, stack_end=0x7e998c676000) at rts/sm/Scav.c:1908
          #8  0x0000000000934295 in scavenge_one
              (p=0x7e998c66e000) at rts/sm/Scav.c:1466
          #9  0x0000000000934662 in scavenge_mutable_list
              (bd=0x7e998d300440, gen=0x1b1d880) at rts/sm/Scav.c:1643
          #10 0x0000000000934700 in scavenge_capability_mut_lists
              (cap=0x1aaa340) at rts/sm/Scav.c:1664
          #11 0x00000000009299b6 in GarbageCollect
              (collect_gen=0, do_heap_census=false, gc_type=2, cap=0x1aaa340, idle_cap=0x1b38aa0)
              at rts/sm/GC.c:378
          #12 0x0000000000907a4a in scheduleDoGC
              (pcap=0x7ffdec5b5310, task=0x1b36650, force_major=false) at rts/Schedule.c:1798
          #13 0x0000000000905de7 in schedule
              (initialCapability=0x1aaa340, task=0x1b36650) at rts/Schedule.c:546
          #14 0x0000000000908bc4 in scheduleWaitThread
              (tso=0x7e998c0067c8, ret=0x0, pcap=0x7ffdec5b5430) at rts/Schedule.c:2537
          #15 0x000000000091b5a0 in rts_evalLazyIO
              (cap=0x7ffdec5b5430, p=0x9c11f0, ret=0x0) at rts/RtsAPI.c:530
          #16 0x000000000091ca56 in hs_main
              (argc=1, argv=0x7ffdec5b5628, main_closure=0x9c11f0, rts_config=...) at rts/RtsMain.c:72
          #17 0x0000000000421ea0 in main
              ()
      
      In particular, dbl_link_onto() which is used to add a freed block to a
      doubly-linked free list is not thread safe and corrupts the list when
      called concurrently.
      
      Note that thread 1 is to blame here as thread 2 is properly taking the
      spinlock. With this patch we now take the spinlock when freeing a todo
      block in GC, avoiding this race.
      
      Test Plan:
      - Tried slow validate locally: this patch does not introduce new failures.
      - circleci: https://circleci.com/gh/ghc/ghc-diffs/283 The test got killed
        because it took 5 hours but T7919 (which was previously failing on circleci)
        passed.
      
      Reviewers: simonmar, bgamari, erikd
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15285
      
      Differential Revision: https://phabricator.haskell.org/D5115
      
      (cherry picked from commit c6fbac6a)
      d46dd452
    • Ben Gamari's avatar
      Bump Cabal submodule to 2.4.0.0 · 3b998a93
      Ben Gamari authored
      3b998a93
    • Ben Gamari's avatar
      Do a final pass over the changelogs · e8f79c95
      Ben Gamari authored
      e8f79c95
  2. 23 Aug, 2018 11 commits
    • David Feuer's avatar
      Expose the StableName constructor · 768cc53d
      David Feuer authored
      * Move the definition of `StableName` from `System.Mem.StableName`
        to a new `GHC.StableName` module.
      
      * Expose the `StableName` data constructor from `GHC.StableName`.
        Once we have `UnliftedArray#`, this will enable `StableName`s to
        be stored in `UnliftedArray`s (from `primitive`) without unsafe
        coercions.
      
      Reviewers: hvr, bgamari, andrewthad, osa1
      
      Reviewed By: osa1
      
      Subscribers: osa1, rwbarton, carter
      
      GHC Trac Issues: #15535
      
      Differential Revision: https://phabricator.haskell.org/D5078
      
      (cherry picked from commit 9c4e6c6b)
      768cc53d
    • Ryan Scott's avatar
      Properly designate LambdaCase alts as CaseAlt in TH · e57a15d8
      Ryan Scott authored
      Summary:
      When `\case` expressions are parsed normally, their
      alternatives are marked as `CaseAlt` (which means that they are
      pretty-printed without a `\` character in front of them, unlike for
      lambda expressions). However, `\case` expressions created by way of
      Template Haskell (in `Convert`) inconsistently designated the case
      alternatives as `LambdaExpr`, causing them to be pretty-printed
      poorly (as shown in #15518). The fix is simple: use `CaseAlt`
      consistently.
      
      Test Plan: make test TEST=T15518
      
      Reviewers: goldfire, bgamari
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15518
      
      Differential Revision: https://phabricator.haskell.org/D5069
      
      (cherry picked from commit 32008a9d)
      e57a15d8
    • Ryan Scott's avatar
      Suppress redundant givens during error reporting · 89ad5fed
      Ryan Scott authored
      Summary:
      When GHC reports that it cannot solve a constraint in error
      messages, it often reports what given constraints it has in scope.
      Unfortunately, sometimes redundant constraints (like `* ~ *`,
      from  #15361) can sneak in. The fix is simple: blast away these
      redundant constraints using `mkMinimalBySCs`.
      
      Test Plan: make test TEST=T15361
      
      Reviewers: simonpj, bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #15361
      
      Differential Revision: https://phabricator.haskell.org/D5002
      
      (cherry picked from commit c552feea)
      89ad5fed
    • Simon Jakobi's avatar
      --show-iface: Qualify all non-local names · c69c9d39
      Simon Jakobi authored
      Summary:
      In order to disambiguate names from different modules, qualify all names
      that don't originate in the current module.
      
      Also update docs for QueryQualifyName
      
      Test Plan: validate
      
      Reviewers: simonpj, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: rwbarton, thomie, carter, tdammers
      
      GHC Trac Issues: #15269
      
      Differential Revision: https://phabricator.haskell.org/D4852
      
      (cherry picked from commit d42eef34)
      c69c9d39
    • Simon Peyton Jones's avatar
      Accommodate API change in transSuperClasses · 02829747
      Simon Peyton Jones authored
      In this patch
      
          commit 6eabb6dd
          Author: Simon Peyton Jones <simonpj@microsoft.com>
          Date:   Tue Dec 15 14:26:13 2015 +0000
      
          Allow recursive (undecidable) superclasses
      
      I changed (transSuperClasses p) to return only the
      superclasses of p, but not p itself. (Previously it always
      returned p as well.)
      
      The use of transSuperClasses in TcErrors.warnRedundantConstraints
      really needs 'p' in the result -- but I faild to fix this
      call site, and instead crippled the test for Trac #10100.
      
      This patch sets things right
      
      * Accomodates the API change
      * Re-enables T10100
      * And thereby fixes Trac #11474
      
      (cherry picked from commit 4293a80a)
      02829747
    • Simon Peyton Jones's avatar
      Fix a typo in TcValidity.checkFamInstRhs · 047c17a4
      Simon Peyton Jones authored
      In error message generation we were using the wrong
      type constructor in inst_head.  Result: the type became
      ill-kinded, and that sent the compiler into a loop.
      
      A separate patch fixes the loop. This patch fixes the
      actual bug -- Trac #15473.
      
      I also improved the "occurs more often" error message
      a bit.  But it's still pretty terrible:
      
          * Variable ‘a’ occurs more often
            in the type family application ‘Undefined’
            than in the instance head ‘LetInterleave xs t ts is y z’
      
      It looks like nonsense, but all becomes clear if you use
      -fprint-explicit-kinds.  Really we should fix this by spotting
      when invisible arguments are involved and at least suggesting
      -fprint-explicit-kinds.
      
      (cherry picked from commit 8c7f90ab)
      047c17a4
    • Simon Peyton Jones's avatar
      Turn infinite loop into a panic · d3ce8842
      Simon Peyton Jones authored
      In these two functions
        * TcIface.toIfaceAppTyArgsX
        * Type.piResultTys
      we take a type application (f t1 .. tn) and try to find
      its kind. It turned out that, if (f t1 .. tn) was ill-kinded
      the function would go into an infinite loop.
      
      That's not good: it caused the loop in Trac #15473.
      
      This patch doesn't fix the bug in #15473, but it does turn the
      loop into a decent panic, which is a step forward.
      
      (cherry picked from commit db6f1d9c)
      d3ce8842
    • Ben Gamari's avatar
      testsuite: Add (broken) test for #15473 · 7c819cbe
      Ben Gamari authored
      (cherry picked from commit 5487f305)
      7c819cbe
    • Alec Theriault's avatar
      Explicitly tell 'getNameToInstances' mods to load · 18cb44df
      Alec Theriault authored
      Calculating which modules to load based on the InteractiveContext means
      maintaining a potentially very large GblRdrEnv.
      
      In Haddock's case, it is much cheaper (from a memory perspective) to
      just keep track of which modules interfaces we want loaded then hand
      these off explicitly to 'getNameToInstancesIndex'.
      
      Bumps haddock submodule.
      
      Reviewers: alexbiehl, bgamari
      
      Reviewed By: alexbiehl
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D5003
      
      (cherry picked from commit c971e119)
      18cb44df
    • David Eichmann's avatar
      Correct limb length and assertion for gcdExtInteger · c53a9f73
      David Eichmann authored
      Reviewers: hvr, bgamari, monoidal
      
      Reviewed By: monoidal
      
      Subscribers: monoidal, rwbarton, thomie, carter
      
      GHC Trac Issues: #15350
      
      Differential Revision: https://phabricator.haskell.org/D5042
      
      (cherry picked from commit c3315921)
      c53a9f73
    • Bodigrim's avatar
      Fix gcdExtInteger (trac#15350) · 767f5660
      Bodigrim authored
      (cherry picked from commit 7c207c86)
      767f5660
  3. 21 Aug, 2018 3 commits
    • Ben Gamari's avatar
      rts: Align the_gc_thread to 64 bytes · c3e50b05
      Ben Gamari authored
      In a previous attempt (c6cc93bc) I had
      tried aligning to 8 bytes under the assumption that the problem was that
      the_gc_thread, a StgWord8[], wasn't being aligned to 8-bytes as the
      gc_thread struct would expect. However, we actually need even stronger
      alignment due to the alignment attribute attached to gen_workspace,
      which claims it should be aligned to a 64-byte boundary.
      
      This fixes #15482.
      
      Reviewers: erikd, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15482
      
      Differential Revision: https://phabricator.haskell.org/D5052
      
      (cherry picked from commit 68a1fc29)
      c3e50b05
    • Simon Peyton Jones's avatar
      Set strictness correctly for JoinIds · b81fc821
      Simon Peyton Jones authored
      We were failing to keep correct strictness info when eta-expanding
      join points; Trac #15517.   The situation was something like
      
        \q v eta ->
           let j x = error "blah
               -- STR Lx   bottoming!
           in case y of
                 A -> j x eta
                 B -> blah
                 C -> j x eta
      
      So we spot j as a join point and eta-expand it.  But we must
      also adjust the stricness info, else it vlaimes to bottom after
      one arg is applied but now it has become two.
      
      I fixed this in two places:
      
       - In CoreOpt.joinPointBinding_maybe, adjust strictness info
      
       - In SimplUtils.tryEtaExpandRhs, return consistent values
         for arity and bottom-ness
      
      (cherry picked from commit ce6ce788)
      b81fc821
    • Ryan Scott's avatar
      Be mindful of GADT tyvar order when desugaring record updates · 2d308da2
      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)
      2d308da2
  4. 20 Aug, 2018 1 commit
  5. 19 Aug, 2018 3 commits
    • wz1000's avatar
      Check if files are same in combineSrcSpans · 033d6ac7
      wz1000 authored
      Summary: If this is not checked, SrcSpans are sometimes mangled by CPP.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, dfeuer
      
      Reviewed By: bgamari
      
      Subscribers: dfeuer, rwbarton, thomie, carter
      
      GHC Trac Issues: #15279
      
      Differential Revision: https://phabricator.haskell.org/D4866
      
      (cherry picked from commit f7f9820e)
      033d6ac7
    • Ryan Scott's avatar
      Fix #15527 by pretty-printing an RdrName prefixly · fb8b2cb1
      Ryan Scott authored
      Summary:
      When `(.) @Int` is used without enabling `TypeApplications`,
      the resulting error message will pretty-print the (symbolic)
      `RdrName` `(.)`. However, it does so without parenthesizing it, which
      causes the pretty-printed expression to appear as `.@Int`. Yuck.
      
      Since the expression in a type application will always be prefix,
      we can fix this issue by using `pprPrefixOcc` instead of plain ol'
      `ppr`.
      
      Test Plan: make test TEST=T15527
      
      Reviewers: bgamari, monoidal, simonpj
      
      Reviewed By: monoidal, simonpj
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15527
      
      Differential Revision: https://phabricator.haskell.org/D5071
      
      (cherry picked from commit 5238f204)
      fb8b2cb1
    • Christiaan Baaij's avatar
      Filter plugin dylib locations · 13105a1a
      Christiaan Baaij authored
      Summary:
      Previously we just created a cartesian product of the library
      paths of the plugin package and the libraries of the package.
      Of course, some of these combinations result in a filepath of
      a file doesn't exists, leading to #15475.
      
      Instead of making `haskFile` return Nothing in case a file
      doesn't exist (which would hide errors), we look at all the
      possible dylib locations and ensure that at least one of those
      locations is an existing file. If the list turns out to be
      empty however, we panic.
      
      Reviewers: mpickering, bgamari
      
      Reviewed By: mpickering
      
      Subscribers: monoidal, rwbarton, carter
      
      GHC Trac Issues: #15475
      
      Differential Revision: https://phabricator.haskell.org/D5048
      
      (cherry picked from commit b324c562)
      13105a1a
  6. 11 Aug, 2018 1 commit
  7. 10 Aug, 2018 1 commit
  8. 09 Aug, 2018 7 commits
  9. 08 Aug, 2018 1 commit
  10. 07 Aug, 2018 2 commits
  11. 06 Aug, 2018 3 commits