Opened 2 weeks ago

Last modified 34 hours 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:

Description

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 5 days ago by bgamari

Milestone: 8.6.3

Ticket retargeted after milestone closed

comment:2 Changed 34 hours 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.