ghc sensitive to struct layout
simonmar at microsoft.com
Thu Feb 10 08:18:15 EST 2005
On 09 February 2005 08:53, Axel Simon wrote:
> gcc uses a different convention from the Microsoft environment when it
> comes to laying out fields in C structs, in particular bit fields.
> Can I pass the -optc--mms-bitfields to ghc when it compiles via C
> without negative effect?
> This flag is not implicit at the moment which I assume means that ghc
> itself is not compiled with --mms-bitfields on Windows. ghc surely
> includes struct declarations when it compiles the generated C files,
> so the question is whether all its structs are laid out the same
> regardless of which layout option one chooses.
The answer is I don't know, but we could probably make it true if
In GHC 6.4, the generated HC code doesn't use any structs, all the field
offests are precomputed, which will no doubt make your life easier.
One thing you could do (in 6.4) is to compile
ghc/include/mkDerivedConstants.c with and without -mms-bitfields and see
if it generates the same output. If it does, then we have some
confidence that -mms-bitfields won't cause any grief. If it doesn't,
then we have some clue about what needs fixing.
More information about the Glasgow-haskell-users