Opened 15 months ago

Last modified 12 months ago

#7598 new bug

ghc-stage1 generates wrong assembler on StgCmmPrim (operand out of range)

Reported by: kgardas Owned by:
Priority: high Milestone: 7.8.3
Component: Compiler Version: 7.7
Keywords: Cc: pho@…, mle+hs@…
Operating System: Linux Architecture: powerpc
Type of failure: Building GHC failed Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:


an attempt to compile today GHC HEAD on linux powerpc fails with this message

"inplace/bin/ghc-stage1" -static  -H32m -O    -package-name ghc-7.7.20130115 -hide-all-packages -i -icompiler/basicTypes -icompiler/cmm -icompiler/codeGen -icompiler/coreSyn -icompiler/deSugar -icompiler/ghci -icompiler/hsSyn -icompiler/iface -icompiler/llvmGen -icompiler/main -icompiler/nativeGen -icompiler/parser -icompiler/prelude -icompiler/profiling -icompiler/rename -icompiler/simplCore -icompiler/simplStg -icompiler/specialise -icompiler/stgSyn -icompiler/stranal -icompiler/typecheck -icompiler/types -icompiler/utils -icompiler/vectorise -icompiler/stage2/build -icompiler/stage2/build/autogen -Icompiler/stage2/build -Icompiler/stage2/build/autogen -Icompiler/../rts/dist/build -Icompiler/stage2 -Icompiler/. -Icompiler/parser -Icompiler/utils   -optP-DGHCI -optP-include -optPcompiler/stage2/build/autogen/cabal_macros.h -package Cabal-1.17.0 -package array- -package base- -package bin-package-db- -package bytestring- -package containers- -package directory- -package filepath- -package hoopl- -package hpc- -package process- -package template-haskell- -package time- -package transformers- -package unix-  -Wall -fno-warn-name-shadowing -XHaskell98 -XNondecreasingIndentation -XCPP -XMagicHash -XUnboxedTuples -XPatternGuards -XForeignFunctionInterface -XEmptyDataDecls -XTypeSynonymInstances -XMultiParamTypeClasses -XFlexibleInstances -XRankNTypes -XScopedTypeVariables -XDeriveDataTypeable -XBangPatterns -DGHCI_TABLES_NEXT_TO_CODE -DSTAGE=2 -O2  -no-user-package-db -rtsopts      -odir compiler/stage2/build -hidir compiler/stage2/build -stubdir compiler/stage2/build -hisuf hi -osuf  o -hcsuf hc -c compiler/codeGen/StgCmmPrim.hs -o compiler/stage2/build/StgCmmPrim.o
/tmp/ghc20445_0/ghc20445_0.s: Assembler messages:

     Error: operand out of range (0x00000000000081ac is not between 0xffffffffffff8000 and 0x0000000000007ffc)
make[1]: *** [compiler/stage2/build/StgCmmPrim.o] Error 1
make: *** [all] Error 2

The platform is 32bit PowerPC running debian wheezy which provides GHC 7.4.1 used for bootstrapping GHC HEAD.

Attachments (1)

ghc20585_0.s.bz2 (116.3 KB) - added by kgardas 15 months ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 15 months ago by kgardas

if assembler correctly reports line number, then this should be this:

  98877 .text
  98878 .align 2
  98879         .long   uVbd_srtd-(cN2c_info)+0
  98880         .long   4
  98881         .long   2162687
  98882 cN2c_info:
  98883 .LcN2c:
  98884         mr      31, 14
  98885         andi.   30, 31, 3
  98886         cmplwi  30, 2
  98887         blt     $+8
  98888         b       .LcNoE
  98889 .LcNoD:
  98890         lis     31, cNdK_info@ha
  98891         addi    31, 31, cNdK_info@l
  98892         stw     31, 0(22)
  98893         lwz     14, 4(22)
  98894         andi.   31, 14, 3
  98895         cmpwi   31, 0
->98896         bne     .LcNdK
  98897 .LcOgw:
  98898         lwz     31, 0(14)
  98899         mtctr   31
  98900         bctr

am I right assuming we're generating jump and it's too long for PPC to perform? i.e. bne is conditional branch instruction which should jump just in a range of 16K. Full assembler file generated attached for your convenient.

Changed 15 months ago by kgardas

comment:2 Changed 15 months ago by PHO

  • Cc pho@… added

Perhaps duplicate of #709?

comment:3 Changed 15 months ago by kgardas

Yes, this is indeed the same issue. In fact my workaround for this and my testing if I'm right is to turn all BCC isns into BCCFAR in genCondJump and viola I've been able to build HEAD on my 32bit PPC board.

comment:4 Changed 12 months ago by igloo

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

#709 is closed, so is this also fixed now?

comment:5 Changed 12 months ago by igloo

See also #7830

comment:6 Changed 12 months ago by erikd

  • Cc mle+hs@… added
Note: See TracTickets for help on using tickets.