Bug 15939 - Support of 64 bits unsigned ranged integers
Summary: Support of 64 bits unsigned ranged integers
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-11 12:42 UTC by Jean-Charles Salzeber
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host: i486-pc-linux-gnu
Target: i486-pc-linux-gnu
Build: i486-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Charles Salzeber 2004-06-11 12:42:44 UTC
A 64 bits unsigned ranged integer type definition won't be accepted by GNAT (on 
x86).
This may not be a real bug, but a limitation. In this case requalify this report 
as a feature request since I think it could be implemented (and in fact is 
implemented but just for modular types, so without range/overflow checking).
The following code demonstrate what I'm saying:
package int64 is

  type Unsigned_Modular_64 is mod 2**64;
  type Unsigned_Ranged_63  is range 0 .. 16#7FFF_FFFF_FFFF_FFFF#;
  type Signed_Ranged_64    is range -(2**63 - 1) .. 2**63 - 1;

  -- Following won't be accepted
  type Unsigned_Ranged_64  is range 0 .. 16#8000_0000_0000_0000#;

end int64;

Compilation gives:
$ gnatmake int64.ads
gcc-3.4 -c int64.ads
int64.ads:8:31: integer type definition bounds out of range
gnatmake: "int64.ads" compilation error

Cheers,
JC
Comment 1 Arnaud Charlet 2004-06-11 12:48:45 UTC
As you said, if you want unsigned 64 bits, you can use modular types.

For range types, extra arithmetic is needed for overflow checks, etc...
and since GCC only support up to 64bits integer, this won't get
implemented.

Arno