Opened 3 years ago

Closed 2 years ago

#7267 closed bug (fixed)

linux-ppc64: Segfault during stage2 build

Reported by: erikd Owned by:
Priority: high Milestone: 7.8.1
Component: Compiler Version: 7.7
Keywords: Cc: pho@…
Operating System: Linux Architecture: powerpc64
Type of failure: Building GHC failed Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

Build segfaults during the command:

inplace/lib/ghc-stage2 -H32m -O -Werror -Wall -H64m -O0 -hide-all-packages -i \
-iutils/haddock/src -iutils/haddock/dist/build -iutils/haddock/dist/build/autogen \
-Iutils/haddock/dist/build -Iutils/haddock/dist/build/autogen -optP-DIN_GHC_TREE \
-optP-include -optPutils/haddock/dist/build/autogen/cabal_macros.h -package Cabal-1.17.0 \
-package array-0.4.0.1 -package base-4.6.0.0 -package containers-0.5.0.0 -package \
directory-1.2.0.0 -package filepath-1.3.0.1 -package ghc-7.7.20120921 -package \
pretty-1.1.1.0 -package xhtml-3000.2.1 -package deepseq-1.3.0.1 -funbox-strict-fields \
-O2 -Wall -fwarn-tabs -XHaskell2010 -XCPP -XDeriveDataTypeable -XScopedTypeVariables \
-XMagicHash -no-user-package-db -rtsopts -odir utils/haddock/dist/build -hidir \
utils/haddock/dist/build -stubdir utils/haddock/dist/build -hisuf hi -osuf o -hcsuf hc \
-c utils/haddock/src/Haddock/GhcUtils.hs -o utils/haddock/dist/build/Haddock/GhcUtils.o

Running under GDB and grabbing backtrace results in:

Program received signal SIGSEGV, Segmentation fault.
0x00000000136d1cf8 in .StgRun ()
(gdb) bt
#0  0x00000000136d1cf8 in .StgRun ()
#1  0x00000000136cd7a0 in .schedule ()
#2  0x00000000136cea2c in .scheduleWaitThread ()
#3  0x00000000137066fc in .rts_evalLazyIO ()
#4  0x00000000136c8ed8 in .real_main ()
#5  0x00000000136c9078 in .hs_main ()
#6  0x000000001002b358 in .main ()

Change History (8)

comment:1 Changed 2 years ago by erikd

Back to debugging this one. Noticed things like:

/tmp/ghc16063_0/ghc16063_0.hc:3204:2:
     warning: conflicting types for built-in function 'memcpy' [enabled by default]

resulting from compiler/utils/StringBuffer.lhs which generates compiler/utils/StringBuffer.hc containing:

ghcFunPtr = ((void * (*)(void *, void *, W_))memcpy);

however, memcpy really has a type:

void *memcpy(void *dest, const void *src, size_t n);

with a const on the src parameter. Pretty sure this is not relevant to this problem.

comment:2 Changed 2 years ago by erikd

A bigger concern is these:

warning: implicit declaration of function 'hs_popcnt8' [-Wimplicit-function-declaration]
warning: implicit declaration of function 'hs_popcnt16' [-Wimplicit-function-declaration]
warning: implicit declaration of function 'hs_popcnt32' [-Wimplicit-function-declaration]
warning: implicit declaration of function 'hs_popcnt64' [-Wimplicit-function-declaration]

comment:3 Changed 2 years ago by erikd

I added this to include/Stg.h:

StgWord hs_popcnt8(StgWord8 x);
StgWord hs_popcnt16(StgWord16 x);
StgWord hs_popcnt32(StgWord32 x);
StgWord hs_popcnt64(StgWord64 x);

which fixed the compiler warnings, but the segfault still happens.

Back to gdb for me.

comment:4 Changed 2 years ago by simonmar

  • difficulty set to Unknown
  • Milestone set to 7.8.1
  • Priority changed from normal to high

There is general breakage in the C backend at the moment, due to fallout from the new code generator. I'm trying to work through the bugs. I have a fix for one crash to be committed as soon as it finishes validate, but there might be more to come.

I don't think the warnings about memcpy are serious, but we should probably add the popcnt prototypes somewhere.

comment:5 Changed 2 years ago by erikd

No, the memcpy etc warnings are not serious, but if they were fixed, we could use -Werror (at least for developer builds) which might flush out problems sooner. Also agree about the popcnt prototypes.

I'll leave this bug until the weekend to see if any of your pending changes fix things.

comment:6 Changed 2 years ago by PHO

  • Cc pho@… added

comment:7 Changed 2 years ago by simonmar

My unregisterised Linux/x86_64 build is working now, except for some failure in Haddock that I'm looking into. The stage2 compiler has built and doesn't seem to be crashing. So now is probably a good time to test this again.

comment:8 Changed 2 years ago by erikd

  • Resolution set to fixed
  • Status changed from new to closed

Yep, my linux-powerpc64 machine got past the segfault in this bug and then hit a haddock bug.

Closing this.

Note: See TracTickets for help on using tickets.