Fri Feb  6 06:02:49 PST 2009  Ian Lynagh <[email protected]>
  * When generating C, don't pretend functions are data
  We used to generated things like:
      extern StgWordArray (newCAF) __attribute__((aligned (8)));
      ((void (*)(void *))(W_)&newCAF)((void *)R1.w);
  (which is to say, pretend that newCAF is some data, then cast it to a
  function and call it).
  This goes wrong on at least IA64, where:
      A function pointer on the ia64 does not point to the first byte of
      code. Intsead, it points to a structure that describes the function.
      The first quadword in the structure is the address of the first byte
      of code
  so we end up dereferencing function pointers one time too many, and
  segfaulting.

    M ./compiler/basicTypes/BasicTypes.lhs +17
    M ./compiler/basicTypes/Literal.lhs -15 +23
    M ./compiler/cmm/CLabel.hs -17 +22
    M ./compiler/cmm/CmmParse.y -2 +3
    M ./compiler/cmm/PprC.hs -13 +18
    M ./compiler/cmm/PprCmm.hs -1 +2
    M ./compiler/cmm/ZipCfgCmmRep.hs -1 +2
    M ./compiler/codeGen/CgForeignCall.hs -1 +2
    M ./compiler/codeGen/CgHpc.hs -1 +4
    M ./compiler/codeGen/CgUtils.hs -1 +1
    M ./compiler/codeGen/StgCmmForeign.hs -1 +1
    M ./compiler/codeGen/StgCmmHpc.hs -1 +1
    M ./compiler/codeGen/StgCmmUtils.hs -1 +1
    M ./compiler/coreSyn/CoreUtils.lhs -1 +1
    M ./compiler/coreSyn/MkExternalCore.lhs -1 +1
    M ./compiler/deSugar/DsForeign.lhs -2 +7
    M ./compiler/ghci/ByteCodeAsm.lhs -2 +2
    M ./compiler/ghci/ByteCodeGen.lhs -1 +1
    M ./compiler/nativeGen/MachCodeGen.hs -3 +4
    M ./compiler/nativeGen/PositionIndependentCode.hs -1 +1
    M ./compiler/utils/Binary.hs +11

View patch online:
http://darcs.haskell.org/ghc/_darcs/patches/20090206140249-3fd76-ad5cb20bb1326deccd63faf8494532de2592127a.gz

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to