Opened 14 months ago

Last modified 8 months ago

#15399 new bug

Build failure on PowerPC 64-bit big endian

Reported by: trommler Owned by: trommler
Priority: normal Milestone: 8.6.1
Component: Compiler Version: 8.5
Keywords: Cc: hvr, bgamari
Operating System: Linux Architecture: powerpc64
Type of failure: Building GHC failed Test Case:
Blocked By: Blocking:
Related Tickets: #15411 Differential Rev(s): Phab:D5001
Wiki Page:


Building GHC 8.6.1 alpha 2 fails with these errors on Powerpc 64-bit big endian Linux:

[ 5076s] utils/check-ppr/Main.hs:44:18: error:
[ 5076s]     * GHC internal error: `astFile' is not in scope during type checking, but it passed the renamer
[ 5076s]       tcl_env of environment: [agVj :-> Identifier[libdir::FilePath, NotLetBound],
[ 5076s]                                agVk :-> Identifier[fileName::String, NotLetBound],
[ 5076s]                                agVl :-> Identifier[p::a, NotLetBound],
[ 5076s]                                agVo :-> Identifier[anns::ApiAnns, TopLevelLet [agVl :-> p] False],
[ 5076s]                                agVp :-> Identifier[pragmas::String, TopLevelLet [agVo :-> anns] False],
[ 5076s]                                agVq :-> Identifier[newFile::FilePath, TopLevelLet [agVk :-> fileName] False],
[ 5076s]                                rfRp :-> Identifier[usage::String, TopLevelLet [] True],
[ 5076s]                                rfU1 :-> Identifier[main::IO (), TopLevelLet [] True],
[ 5076s]                                rfU2 :-> Identifier[testOneFile::FilePath
[ 5076s]                                                                 -> String
[ 5076s]                                                                 -> IO (), TopLevelLet [] True],
[ 5076s]                                rfU3 :-> Identifier[parseOneFile::FilePath
[ 5076s]                                                                  -> FilePath
[ 5076s]                                                                  -> IO
[ 5076s]                                                                       ParsedModule, TopLevelLet [] True],
[ 5076s]                                rfU4 :-> Identifier[getPragmas::ApiAnns -> String, TopLevelLet],
[ 5076s]                                rfU5 :-> Identifier[pp::forall a.
[ 5076s]                                                        Outputable a =>
[ 5076s]                                                        a -> String, TopLevelLet [] True]]
[ 5076s]     * In the first argument of `writeFile', namely `astFile'
[ 5076s]       In a stmt of a 'do' block: writeFile astFile origAst
[ 5076s]       In the expression:
[ 5076s]         do p <- parseOneFile libdir fileName
[ 5076s]            let pped = pragmas ++ "\n" ++ pp (pm_parsed_source p)
[ 5076s]                anns = pm_annotations p
[ 5076s]                ....
[ 5076s]            writeFile astFile origAst
[ 5076s]            writeFile newFile pped
[ 5076s]            ....
[ 5076s]    |
[ 5076s] 44 |        writeFile astFile origAst
[ 5076s]    |                  ^^^^^^^
[ 5076s] utils/check-ppr/ recipe for target 'utils/check-ppr/dist-install/build/Main.o' failed
[ 5076s] make[1]: *** [utils/check-ppr/dist-install/build/Main.o] Error 1
[ 5076s] make[1]: *** Waiting for unfinished jobs....
[ 5077s] 
[ 5077s] utils/check-api-annotations/Main.hs:116:32: error:
[ 5077s]     * GHC internal error: `GenericQ' is not in scope during type checking, but it passed the renamer
[ 5077s]       tcl_env of environment: [agZx :-> Type variable `r' = r :: k0]
[ 5077s]     * In the type signature:
[ 5077s]         everything :: (r -> r -> r) -> GenericQ r -> GenericQ r
[ 5077s]     |
[ 5077s] 116 | everything :: (r -> r -> r) -> GenericQ r -> GenericQ r
[ 5077s]     |                                ^^^^^^^^
[ 5077s] utils/check-api-annotations/ recipe for target 'utils/check-api-annotations/dist-install/build/Main.o' failed
[ 5077s] make[1]: *** [utils/check-api-annotations/dist-install/build/Main.o] Error 1
[ 5077s] 
[ 5077s] utils/ghctags/Main.hs:61:36: error:
[ 5077s]     * GHC internal error: `FoundThing' is not in scope during type checking, but it passed the renamer
[ 5077s]       tcl_env of environment: [rCTr :-> ATcTyCon FileData :: *,
[ 5077s]                                rCTs :-> APromotionErr RecDataConPE,
[ 5077s]                                rCTw :-> ATcTyCon FileName :: *]
[ 5077s]     * In the type `[FoundThing]'
[ 5077s]       In the definition of data constructor `FileData'
[ 5077s]       In the data declaration for `FileData'
[ 5077s]    |
[ 5077s] 61 | data FileData = FileData FileName [FoundThing] (Map Int String)
[ 5077s]    |                                    ^^^^^^^^^^
[ 5077s] utils/ghctags/ recipe for target 'utils/ghctags/dist-install/build/Main.o' failed

Alpha 2 builds fine on PowerPC 64-bit little endian Linux.

I am setting version to 8.5 as there is no tag for 8.6.1 alpha 2 yet.

Change History (11)

comment:1 Changed 14 months ago by trommler

Cc: hvr bgamari added

Currently my last known good commit is changeset:d78dde9.

At changeset:bdfc85b I see the following tests failures during validate:

Unexpected results from:
TEST="ManyAlternatives ManyConstructors T10520 T10858 T12007 T12425 T12545 T12707 T13035 T13379 T13615 T13825-ghci T14894 T1969 T2182ghci T3064 T3294 T4801 T5321FD T5321Fun T5435_v_asm_b T5631 T6048 T7253 T7386 T783 T8557 T9233 duplicaterecfldsghci01 ghc-e006 ghci.prog007 ghci006 ghci039 ghci045 ghci049 ghci052 ghci053 ghcirun001 ghcirun002 heap_all print002 print003 print006 print007 print008 print010 print012 print013 print014 print018 print019 print021 print025 print031 print034"

SUMMARY for test run started at Wed Jul 18 12:35:24 2018 CEST
 1:18:37 spent to go through
    6386 total tests, which gave rise to
   19686 test cases, of which
   13227 were skipped

      38 had missing libraries
    6190 expected passes
     176 expected failures

       2 caused framework failures
       1 caused framework warnings

Note the large number of GHCi tests failing.

I will now bisect in that range above.

Last edited 14 months ago by trommler (previous) (diff)

comment:2 Changed 14 months ago by trommler

The breaking commit is changeset:ec22f7dd. I have found an endianness issue with this commit in compiler/ghci/RtClosureInspect.hs.

I am just validating a patch on ppc64.

comment:3 Changed 14 months ago by trommler

My patch was not quite good enough.

Here is another endianness issue:

        BCO -> do
// removed checks
            let splitWord = rawWds !! 3
            pure $ BCOClosure itbl (pts !! 0) (pts !! 1) (pts !! 2) 
// on big endian this is the wrong way around
                (fromIntegral splitWord)
                (fromIntegral $ shiftR splitWord (wORD_SIZE_IN_BITS `div` 2))
                (drop 4 rawWds)

I need a way to tell whether I am running on a big endian system. Is there any way to know inside without access to DynFlags? Is there even a portable way to read the first half-word from a word in memory?

comment:4 Changed 14 months ago by trommler

Actually, comment:3 applies to AP and PAP closures as well.

comment:5 Changed 14 months ago by trommler

Differential Rev(s): Phab:D5001

Here is a fix for one of the 36 failing GHCi tests. It fixes three endianness issues introduced by changeset:ec22f7dd.

comment:6 Changed 14 months ago by trommler

Owner: set to trommler

comment:7 Changed 14 months ago by bgamari

Milestone: 8.6.1
Status: newmerge

comment:8 Changed 14 months ago by Ben Gamari <ben@…>

In d7cb1bbc/ghc:

Fix endian issues in ghc-heap

In test heap_all arity and n_args were swapped on big endian

Take care of endianness when reading parts of a machine word
from a `Word`.

This fixes one out of 36 failing tests reported in #15399.

Test Plan: validate

Reviewers: simonmar, bgamari, hvr, erikd

Reviewed By: simonmar

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15399

Differential Revision:

comment:9 Changed 14 months ago by bgamari

Resolution: fixed
Status: mergeclosed

comment:10 Changed 8 months ago by trommler

Owner: trommler deleted
Resolution: fixed
Status: closednew

The issue shown in the ticket is a duplicate of #15411.

In the comments for this ticket we found the first breaking commit, which is unrelated to the issue on this ticket, and fixed (Phab:5001) one (out of 36) of the broken tests (see comment:5).

I reopen the ticket so I won't forget to create a new ticket for the remaining 35 failing tests.

comment:11 Changed 8 months ago by trommler

Owner: set to trommler

I will submit a follow-up ticket.

Note: See TracTickets for help on using tickets.