diff options
author | Ian Lynagh <igloo@earth.li> | 2009-02-06 14:02:49 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2009-02-06 14:02:49 +0000 |
commit | 497302c44ad08c6c27d0e15d94a787f332c0cfec (patch) | |
tree | a78fd252a39c2d49b5a5219a2c968004c5a1c029 /compiler/cmm/PprCmm.hs | |
parent | 1353826e5159c9a5a81e75e0b7459271f27c08ea (diff) | |
download | haskell-497302c44ad08c6c27d0e15d94a787f332c0cfec.tar.gz |
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.
Diffstat (limited to 'compiler/cmm/PprCmm.hs')
-rw-r--r-- | compiler/cmm/PprCmm.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/cmm/PprCmm.hs b/compiler/cmm/PprCmm.hs index a9e00fc0ae..504098891a 100644 --- a/compiler/cmm/PprCmm.hs +++ b/compiler/cmm/PprCmm.hs @@ -42,6 +42,7 @@ import BlockId import Cmm import CmmUtils import CLabel +import BasicTypes import ForeignCall @@ -275,7 +276,7 @@ pprStmt stmt = case stmt of pprStmt (CmmCall (CmmCallee (CmmLit lbl) CCallConv) results args safety ret) where - lbl = CmmLabel (mkForeignLabel (mkFastString (show op)) Nothing False) + lbl = CmmLabel (mkForeignLabel (mkFastString (show op)) Nothing False IsFunction) CmmBranch ident -> genBranch ident CmmCondBranch expr ident -> genCondBranch expr ident |