Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cborg-0.2.8.0 fails to build with 32bit ghc9 #309

Open
juhp opened this issue Mar 16, 2023 · 2 comments · May be fixed by #322
Open

cborg-0.2.8.0 fails to build with 32bit ghc9 #309

juhp opened this issue Mar 16, 2023 · 2 comments · May be fixed by #322

Comments

@juhp
Copy link

juhp commented Mar 16, 2023

Here are the errors with ghc-9.2 for Fedora 38 i686:

[ 4 of 14] Compiling Codec.CBOR.Decoding

src/Codec/CBOR/Decoding.hs:426:62: error:
    • Couldn't match expected type ‘Word#’ with actual type ‘Word64#’
    • In the first argument of ‘toWord64’, namely ‘w64#’
      In the first argument of ‘k’, namely ‘(toWord64 w64#)’
      In the expression: k (toWord64 w64#)
    |
426 |   Decoder (\k -> return (ConsumeWord64 (\w64# -> k (toWord64 w64#))))
    |                                                              ^^^^

src/Codec/CBOR/Decoding.hs:445:65: error:
    • Couldn't match expected type ‘Word#’ with actual type ‘Word64#’
    • In the first argument of ‘toWord64’, namely ‘w64#’
      In the first argument of ‘k’, namely ‘(toWord64 w64#)’
      In the expression: k (toWord64 w64#)
    |
445 |   Decoder (\k -> return (ConsumeNegWord64 (\w64# -> k (toWord64 w64#))))
    |                                                                 ^^^^

src/Codec/CBOR/Decoding.hs:485:60: error:
    • Couldn't match expected type ‘Int#’ with actual type ‘Int64#’
    • In the first argument of ‘toInt64’, namely ‘n64#’
      In the first argument of ‘k’, namely ‘(toInt64 n64#)’
      In the expression: k (toInt64 n64#)
    |
485 |   Decoder (\k -> return (ConsumeInt64 (\n64# -> k (toInt64 n64#))))
    |                                                            ^^^^

src/Codec/CBOR/Decoding.hs:525:71: error:
    • Couldn't match expected type ‘Word#’ with actual type ‘Word64#’
    • In the first argument of ‘toWord64’, namely ‘w64#’
      In the first argument of ‘k’, namely ‘(toWord64 w64#)’
      In the expression: k (toWord64 w64#)
    |
525 |   Decoder (\k -> return (ConsumeWord64Canonical (\w64# -> k (toWord64 w64#))))
    |                                                                       ^^^^

src/Codec/CBOR/Decoding.hs:544:74: error:
    • Couldn't match expected type ‘Word#’ with actual type ‘Word64#’
    • In the first argument of ‘toWord64’, namely ‘w64#’
      In the first argument of ‘k’, namely ‘(toWord64 w64#)’
      In the expression: k (toWord64 w64#)
    |
544 |   Decoder (\k -> return (ConsumeNegWord64Canonical (\w64# -> k (toWord64 w64#))))
    |                                                                          ^^^^

src/Codec/CBOR/Decoding.hs:584:69: error:
    • Couldn't match expected type ‘Int#’ with actual type ‘Int64#’
    • In the first argument of ‘toInt64’, namely ‘n64#’
      In the first argument of ‘k’, namely ‘(toInt64 n64#)’
      In the expression: k (toInt64 n64#)
    |
584 |   Decoder (\k -> return (ConsumeInt64Canonical (\n64# -> k (toInt64 n64#))))
    |                                                                     ^^^^
[ 5 of 14] Compiling Codec.CBOR.Encoding[boot]
[ 6 of 14] Compiling Codec.CBOR.FlatTerm[boot]
[ 7 of 14] Compiling Codec.CBOR.Encoding
[ 8 of 14] Compiling Codec.CBOR.Magic

src/Codec/CBOR/Magic.hs:176:43: error:
    • Couldn't match expected type ‘Word64#’ with actual type ‘Word#’
    • In the first argument of ‘byteSwap64#’, namely
        ‘(word64ToWord# (indexWord64OffAddr# ip# 0#))’
      In the first argument of ‘W64#’, namely
        ‘(byteSwap64# (word64ToWord# (indexWord64OffAddr# ip# 0#)))’
      In the expression:
        W64# (byteSwap64# (word64ToWord# (indexWord64OffAddr# ip# 0#)))
    |
176 | grabWord64 (Ptr ip#) = W64# (byteSwap64# (word64ToWord# (indexWord64OffAddr# ip# 0#)))
    |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Codec/CBOR/Magic.hs:487:17: error:
    • Couldn't match expected type ‘Word#’ with actual type ‘Word32#’
    • In the first argument of ‘ltWord#’, namely ‘w#’
      In the first argument of ‘isTrue#’, namely
        ‘(w# `ltWord#` 0x80000000##)’
      In the expression: isTrue# (w# `ltWord#` 0x80000000##)
    |
487 |   case isTrue# (w# `ltWord#` 0x80000000##) of
    |                 ^^

src/Codec/CBOR/Magic.hs:533:56: error:
    • Couldn't match expected type ‘Word#’ with actual type ‘Word8#’
    • In the first argument of ‘word2Int#’, namely ‘w#’
      In the first argument of ‘intToInt64#’, namely ‘(word2Int# w#)’
      In the first argument of ‘I64#’, namely
        ‘(intToInt64# (word2Int# w#))’
    |
533 | word8ToInt64  (W8#  w#) = I64# (intToInt64# (word2Int# w#))
    |                                                        ^^

src/Codec/CBOR/Magic.hs:534:56: error:
    • Couldn't match expected type ‘Word#’ with actual type ‘Word16#’
    • In the first argument of ‘word2Int#’, namely ‘w#’
      In the first argument of ‘intToInt64#’, namely ‘(word2Int# w#)’
      In the first argument of ‘I64#’, namely
        ‘(intToInt64# (word2Int# w#))’
    |
534 | word16ToInt64 (W16# w#) = I64# (intToInt64# (word2Int# w#))
    |                                                        ^^

src/Codec/CBOR/Magic.hs:535:63: error:
    • Couldn't match expected type ‘Word#’ with actual type ‘Word32#’
    • In the first argument of ‘wordToWord64#’, namely ‘w#’
      In the first argument of ‘word64ToInt64#’, namely
        ‘(wordToWord64# w#)’
      In the first argument of ‘I64#’, namely
        ‘(word64ToInt64# (wordToWord64# w#))’
    |
535 | word32ToInt64 (W32# w#) = I64# (word64ToInt64# (wordToWord64# w#))
    |                                                               ^^

src/Codec/CBOR/Magic.hs:541:48: error:
    • Couldn't match expected type ‘Word#’ with actual type ‘Word8#’
    • In the first argument of ‘wordToWord64#’, namely ‘w#’
      In the first argument of ‘W64#’, namely ‘(wordToWord64# w#)’
      In the expression: W64# (wordToWord64# w#)
    |
541 | word8ToWord64  (W8#  w#) = W64# (wordToWord64# w#)
    |                                                ^^

src/Codec/CBOR/Magic.hs:542:48: error:
    • Couldn't match expected type ‘Word#’ with actual type ‘Word16#’
    • In the first argument of ‘wordToWord64#’, namely ‘w#’
      In the first argument of ‘W64#’, namely ‘(wordToWord64# w#)’
      In the expression: W64# (wordToWord64# w#)
    |
542 | word16ToWord64 (W16# w#) = W64# (wordToWord64# w#)
    |                                                ^^

src/Codec/CBOR/Magic.hs:543:48: error:
    • Couldn't match expected type ‘Word#’ with actual type ‘Word32#’
    • In the first argument of ‘wordToWord64#’, namely ‘w#’
      In the first argument of ‘W64#’, namely ‘(wordToWord64# w#)’
      In the expression: W64# (wordToWord64# w#)
    |
543 | word32ToWord64 (W32# w#) = W64# (wordToWord64# w#)
    |                                                ^^

It builds fine on 64bit archs

@juhp
Copy link
Author

juhp commented Mar 16, 2023

This probably supercedes #293

@juhp juhp changed the title cborg-0.2.8.0 fails to build on 32bit with ghc9 cborg-0.2.8.0 fails to build with 32bit ghc9 Mar 16, 2023
@dhess
Copy link

dhess commented Mar 16, 2023

Oddly, we're getting a very similar failure, but on aarch64-darwin with GHC 9.4.4:

[ 5 of 14] Compiling Codec.CBOR.Magic ( src/Codec/CBOR/Magic.hs, dist/build/Codec/CBOR/Magic.o, dist/build/Codec/CBOR/Magic.dyn_o )

src/Codec/CBOR/Magic.hs:260:20: error:
    • Couldn't match expected type ‘Word64#’ with actual type ‘Word#’
    • In the first argument of ‘W64#’, namely ‘(toWord w#)’
      In the expression: W64# (toWord w#)
      In an equation for ‘w64’: w64 w# = W64# (toWord w#)
    |
260 |     w64 w# = W64# (toWord w#)
    |                    ^^^^^^^^^

edit: Possibly addressed in #304 and/or #307, pardon the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants