[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#1023649: ghc: FTBFS haskell-random powerpc (ghc Segmentation fault)



Hi Ilias!

On Wed, 2023-10-04 at 12:26 +0200, John Paul Adrian Glaubitz wrote:
> Looking at the ghc package in openSUSE, I found this patch [1] which disables unboxed arrays
> in order to fix the build on big-endian systems. And, indeed, disabling unboxed arrays in
> libraries/containers/containers/include/containers.h allows me to fully build ghc from git
> on 32-bit PowerPC. See also [2].

I managed to track this down to this commit [1]:

ba089952f034d91718c71f5ef297fe54818559df is the first bad commit
commit ba089952f034d91718c71f5ef297fe54818559df
Author: Sylvain Henry <sylvain@haskus.fr>
Date:   Fri Jan 15 12:33:40 2021 +0100

    Bignum: add Natural constant folding rules (#15821)
    
    * Implement constant folding rules for Natural (similar to Integer ones)
    
    * Add mkCoreUbxSum helper in GHC.Core.Make
    
    * Remove naturalTo/FromInt
    
      We now only provide `naturalTo/FromWord` as
      the semantics is clear (truncate/zero-extend). For Int we have to deal
      with negative numbers (throw an exception? convert to Word
      beforehand?) so we leave the decision about what to do to the caller.
    
      Moreover, now that we have sized types (Int8#, Int16#, ..., Word8#,
      etc.) there is no reason to bless `Int#` more than `Int8#` or `Word8#`
      (for example).
    
    * Replaced a few `()` with `void#`

 compiler/GHC/Builtin/Names.hs                      | 310 +++++++---
 compiler/GHC/Core/Make.hs                          |  14 +-
 compiler/GHC/Core/Opt/ConstantFold.hs              | 670 +++++++++++----------
 compiler/GHC/HsToCore/Expr.hs                      |   6 +-
 compiler/GHC/Types/Id/Make.hs-boot                 |   1 +
 libraries/base/GHC/Enum.hs                         |   4 +-
 libraries/base/GHC/Float.hs                        |   6 +-
 libraries/base/GHC/Int.hs                          |  16 +-
 libraries/base/GHC/Natural.hs                      |  20 +-
 libraries/base/GHC/Num.hs                          |  12 +-
 libraries/base/GHC/Real.hs                         |   2 +-
 libraries/ghc-bignum/src/GHC/Num/BigNat.hs         |  64 +-
 libraries/ghc-bignum/src/GHC/Num/Integer.hs        |  14 +-
 libraries/ghc-bignum/src/GHC/Num/Natural.hs        | 162 +++--
 libraries/ghc-bignum/src/GHC/Num/Primitives.hs     |   4 +-
 libraries/ghc-bignum/src/GHC/Num/WordArray.hs      |   4 +-
 .../integer-gmp/src/GHC/Integer/GMP/Internals.hs   |   8 +-
 testsuite/tests/lib/integer/Makefile               |  50 +-
 testsuite/tests/lib/integer/all.T                  |   1 +
 .../tests/lib/integer/naturalConstantFolding.hs    | 172 ++++++
 .../lib/integer/naturalConstantFolding.stdout      |  38 ++
 testsuite/tests/perf/compiler/T16473.stdout        |   2 +-
 .../tests/simplCore/should_compile/T15445.stderr   |   2 +-
 23 files changed, 1057 insertions(+), 525 deletions(-)
 create mode 100644 testsuite/tests/lib/integer/naturalConstantFolding.hs
 create mode 100644 testsuite/tests/lib/integer/naturalConstantFolding.stdout

And I have verified that this commit actually introduced the segfault on 32-bit PowerPC.

Adrian

> [1] https://gitlab.haskell.org/ghc/ghc/-/commit/ba089952f034d91718c71f5ef297fe54818559df

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913


Reply to: