#11395: The via-C code generation backend is incompatible with gcc 5.3.1 on m68k
(ELF)
--------------------------------------------+------------------------------
Reporter: mkarcher | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.2
Resolution: | Keywords:
Operating System: Linux | Architecture: m68k
Type of failure: GHC doesn't work at all | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
--------------------------------------------+------------------------------
Comment (by Sergei Trofimovich ):
In [changeset:"c42cdb7f6dcfd519d9607ac9fa53f049b2922fb8/ghc" c42cdb7/ghc]:
{{{
#!CommitTicketReference repository="ghc"
revision="c42cdb7f6dcfd519d9607ac9fa53f049b2922fb8"
fix Float/Double unreg cross-compilation
Looking at more failures on m68k (Trac #11395)
I've noticed the arith001 and arith012 test failures.
(--host=x86_64-linux --target=m68k-linux).
The following example was enough to reproduce a problem:
v :: Float
v = 43
main = print v
m68k binaries printed '0.0' instead of '43.0'.
The bug here is how we encode Floats and Double
as Words with the same binary representation.
Floats:
Before the patch we just coerced Float to Int.
That breaks when we cross-compile from
64-bit LE to 32-bit BE.
The patch fixes conversion by accounting for padding.
when we extend 32-bit value to 64-bit value (LE and BE
do it slightly differently).
Doubles:
Before the patch Doubles were coerced to a pair of Ints
(not correct as x86_64 can hold Double in one Int) and
then trucated this pair of Ints to pair of Word32.
The patch fixes conversion by always decomposing in
Word32 and accounting for host endianness (newly
introduced hostBE) and target endianness (wORDS_BIGENDIAN).
I've tested this patch on Double and Float conversion on
--host=x86_64-linux --target=m68k-linux
crosscompiler. It fixes 10 tests related to printing Floats
and Doubles.
Thanks to Bertram Felgenhauer who poined out this probem.
Signed-off-by: Sergei Trofimovich
Test Plan: checked some examples manually, fixed 10 tests in test suite
Reviewers: int-e, austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1990
GHC Trac Issues: #11395
}}}
--
Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11395#comment:24
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler