summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2018-06-17 12:49:51 -0400
committerBen Gamari <ben@smart-cactus.org>2018-06-17 12:50:11 -0400
commitb8e349922b4841771a59e264183219e6cad3e942 (patch)
tree07aa65ea72141f3d28419e3dd597a2101d89d73f /includes
parentc63754118cf6c3d0947d0c611f1db39c78acf1b7 (diff)
downloadhaskell-b8e349922b4841771a59e264183219e6cad3e942.tar.gz
UNREG: fix CmmRegOff large offset handling on W64 platforms
Gabor noticed C warning when building unregisterised 64-bit compiler on GHC.Integer.Types (from integer-simple). Minimised example with a warning: ```haskell {-# LANGUAGE MagicHash #-} {-# LANGUAGE NoImplicitPrelude #-} {-# OPTIONS_GHC -Wall #-} module M (bug) where import GHC.Prim (Word#, minusWord#, ltWord#) import GHC.Types (isTrue#) -- assume Word = Word64 bug :: Word# -> Word# bug x = if isTrue# (x `ltWord#` 0x8000000000000000##) then 0## else x `minusWord#` 0x8000000000000000## ``` ``` $ LANG=C x86_64-UNREG-linux-gnu-ghc -O1 -c M.hs -fforce-recomp /tmp/ghc30219_0/ghc_1.hc: In function 'M_bug_entry': /tmp/ghc30219_0/ghc_1.hc:20:14: error: warning: integer constant is so large that it is unsigned ``` It's caused by limited handling of integer literals in CmmRegOff. This change switches to use standard integer literal pretty-printer. C code before the change: ```c FN_(M_bug_entry) { W_ _sAg; _cAr: _sAg = *Sp; switch ((W_)(_sAg < 0x8000000000000000UL)) { case 0x1UL: goto _cAq; default: goto _cAp; } _cAp: R1.w = _sAg+-9223372036854775808; // ... ``` C code after the change: ```c FN_(M_bug_entry) { W_ _sAg; _cAr: _sAg = *Sp; switch ((W_)(_sAg < 0x8000000000000000UL)) { case 0x1UL: goto _cAq; default: goto _cAp; } _cAp: R1.w = _sAg+(-0x8000000000000000UL); ``` URL: https://mail.haskell.org/pipermail/ghc-devs/2018-June/015875.html Reported-by: Gabor Greif Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Test Plan: test generated code on unregisterised mips64 and amd64 Reviewers: simonmar, ggreif, bgamari Reviewed By: ggreif, bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4856
Diffstat (limited to 'includes')
0 files changed, 0 insertions, 0 deletions