Opened 14 months ago

Last modified 13 months ago

#15973 new bug

Int used to represent target integer literals

Reported by: bgamari Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.6.2
Keywords: newcomer Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


There are numerous places within GHC where we use Int to represent a constant literal for the target. For instance, CmmUtils has the following:

-- XXX: should really be Integer, since Int doesn't necessarily cover
-- the full range of target Ints.
mkIntCLit :: DynFlags -> Int -> CmmLit
mkIntCLit dflags i = CmmInt (toInteger i) (wordWidth dflags)

This could go very wrong when cross-compiling from a 32-bit machine to a 64-bit target.

Change History (2)

comment:1 Changed 14 months ago by bgamari

Milestone: 8.6.3

Ticket retargeted after milestone closed

comment:2 Changed 13 months ago by chessai

Some questions:

Should this be Int64, Int32, or what?

How could one filter out which uses of Int are problematic in this way?

Note: See TracTickets for help on using tickets.