From: Eric Botcazou Date: Fri, 21 Aug 2020 09:22:52 +0000 (+0200) Subject: [Ada] Enable the support of 128-bit integer types by default X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dfb7345cd54e90b4f5cc0234bd37ec2763602180;p=gcc.git [Ada] Enable the support of 128-bit integer types by default gcc/ada/ * Makefile.rtl (GNATRTL_128BIT_PAIRS): Add i-cexten.ads. * debug.adb (d.H): Document new usage. * doc/gnat_rm/representation_clauses_and_pragmas.rst (Size Clauses): Document new limit on 64-bit platforms. (Component_Size Clauses): Likewise. (Pragma Pack for Arrays): Likewise. (Pragma Pack for Records): Likewise. (Record Representation Clauses): Likewise. * gnat_rm.texi: Regenerate. * gnat1drv.adb (Adjust_Global_Switches): Rewrite code enabling or disabling the support for 128-bit integer types. * switch-c.adb (Scan_Front_End_Switches): Do not deal with e128. * usage.adb (Write_Switch_Char): Do not print -gnate128 switch. * libgnat/i-cexten__128.ads: New file. gcc/testsuite/ * ada/acats/run_all.sh: Define and substitute target_{max,min}_int. * ada/acats/support/macro.dfs: Parameterize {MAX,MIN}_INT. * gnat.dg/assert1.adb: Adjust conditionally to 128-bit integer types. * gnat.dg/size_clause1.adb: Do not expect a warning for LP64 targets. * gnat.dg/warn11.adb: Likewise. * gnat.dg/specs/rep_clause5.ads (Array_2_Type): Add alignment clause. --- diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl index 589ba68251d..7a0c05b423d 100644 --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl @@ -888,6 +888,7 @@ GNATRTL_128BIT_PAIRS = \ a-wtmoio.adb True) = No_File + or else Debug_Flag_Dot_HH + then + Enable_128bit_Types := False; + + Ttypes.Standard_Long_Long_Long_Integer_Size := + Ttypes.Standard_Long_Long_Integer_Size; + Ttypes.Standard_Long_Long_Long_Integer_Width := + Ttypes.Standard_Long_Long_Integer_Width; + Ttypes.System_Max_Integer_Size := + Ttypes.Standard_Long_Long_Integer_Size; + Ttypes.System_Max_Binary_Modulus_Power := + Ttypes.Standard_Long_Long_Integer_Size; + end if; end if; -- Finally capture adjusted value of Suppress_Options as the initial diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 49cdd8d5a26..af8bd07da9d 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -18097,12 +18097,12 @@ type My_Boolean is new Boolean; for My_Boolean'Size use 32; @end example -then values of this type will always be 32 bits long. In the case of -discrete types, the size can be increased up to 64 bits, with the effect -that the entire specified field is used to hold the value, sign- or -zero-extended as appropriate. If more than 64 bits is specified, then -padding space is allocated after the value, and a warning is issued that -there are unused bits. +then values of this type will always be 32-bit long. In the case of discrete +types, the size can be increased up to 64 bits on 32-bit targets and 128 bits +on 64-bit targets, with the effect that the entire specified field is used to +hold the value, sign- or zero-extended as appropriate. If more than 64 bits +or 128 bits resp. is specified, then padding space is allocated after the +value, and a warning is issued that there are unused bits. Similarly the size of records and arrays may be increased, and the effect is to add padding bits after the value. This also causes a warning message @@ -18666,8 +18666,9 @@ of this subtype, and must be a multiple of the alignment value. In addition, component size clauses are allowed which cause the array to be packed, by specifying a smaller value. A first case is for -component size values in the range 1 through 63. The value specified -must not be smaller than the Size of the subtype. GNAT will accurately +component size values in the range 1 through 63 on 32-bit targets, +and 1 through 127 on 64-bit targets. The value specified may not +be smaller than the Size of the subtype. GNAT will accurately honor all packing requests in this range. For example, if we have: @example @@ -19087,7 +19088,8 @@ Any small simple record type with a static size. @end itemize For all these cases, if the component subtype size is in the range -1 through 64, then the effect of the pragma @code{Pack} is exactly as though a +1 through 63 on 32-bit targets, and 1 through 127 on 64-bit targets, +then the effect of the pragma @code{Pack} is exactly as though a component size were specified giving the component subtype size. All other types are non-packable, they occupy an integral number of storage @@ -19117,11 +19119,13 @@ using an explicit @code{Component_Size} setting instead, which never generates a warning, since the intention of the programmer is clear in this case. GNAT treats packed arrays in one of two ways. If the size of the array is -known at compile time and is less than 64 bits, then internally the array -is represented as a single modular type, of exactly the appropriate number -of bits. If the length is greater than 63 bits, or is not known at compile -time, then the packed array is represented as an array of bytes, and the -length is always a multiple of 8 bits. +known at compile time and is at most 64 bits on 32-bit targets, and at most +128 bits on 64-bit targets, then internally the array is represented as a +single modular type, of exactly the appropriate number of bits. If the +length is greater than 64 bits on 32-bit targets, and greater than 128 +bits on 64-bit targets, or is not known at compile time, then the packed +array is represented as an array of bytes, and its length is always a +multiple of 8 bits. Note that to represent a packed array as a modular type, the alignment must be suitable for the modular type involved. For example, on typical machines @@ -19197,7 +19201,7 @@ Components of the following types are considered packable: @item Components of an elementary type are packable unless they are aliased, -independent, or of an atomic type. +independent or atomic. @item Small packed arrays, where the size is statically known, are represented @@ -19207,10 +19211,10 @@ internally as modular integers, and so they are also packable. Small simple records, where the size is statically known, are also packable. @end itemize -For all these cases, if the @code{'Size} value is in the range 1 through 64, the -components occupy the exact number of bits corresponding to this value -and are packed with no padding bits, i.e. they can start on an arbitrary -bit boundary. +For all these cases, if the @code{'Size} value is in the range 1 through 64 on +32-bit targets, and 1 through 128 on 64-bit targets, the components occupy +the exact number of bits corresponding to this value and are packed with no +padding bits, i.e. they can start on an arbitrary bit boundary. All other types are non-packable, they occupy an integral number of storage units and the only effect of pragma @code{Pack} is to remove alignment gaps. @@ -19237,7 +19241,7 @@ end record; pragma Pack (X2); @end example -The representation for the record @code{X2} is as follows: +The representation for the record @code{X2} is as follows on 32-bit targets: @example for X2'Size use 224; @@ -19252,17 +19256,16 @@ end record; @end example Studying this example, we see that the packable fields @code{L1} -and @code{L2} are -of length equal to their sizes, and placed at specific bit boundaries (and -not byte boundaries) to -eliminate padding. But @code{L3} is of a non-packable float type (because +and @code{L2} are of length equal to their sizes, and placed at +specific bit boundaries (and not byte boundaries) to eliminate +padding. But @code{L3} is of a non-packable float type (because it is aliased), so it is on the next appropriate alignment boundary. The next two fields are fully packable, so @code{L4} and @code{L5} are minimally packed with no gaps. However, type @code{Rb2} is a packed -array that is longer than 64 bits, so it is itself non-packable. Thus -the @code{L6} field is aligned to the next byte boundary, and takes an -integral number of bytes, i.e., 72 bits. +array that is longer than 64 bits, so it is itself non-packable on +32-bit targets. Thus the @code{L6} field is aligned to the next byte +boundary, and takes an integral number of bytes, i.e., 72 bits. @node Record Representation Clauses,Handling of Records with Holes,Pragma Pack for Records,Representation Clauses and Pragmas @anchor{gnat_rm/representation_clauses_and_pragmas id13}@anchor{28b}@anchor{gnat_rm/representation_clauses_and_pragmas record-representation-clauses}@anchor{28c} @@ -19283,7 +19286,8 @@ clauses is that the size must be at least the @code{'Size} value of the type (actually the Value_Size). There are no restrictions due to alignment, and such components may freely cross storage boundaries. -Packed arrays with a size up to and including 64 bits are represented +Packed arrays with a size up to and including 64 bits on 32-bit targets, +and up to and including 128 bits on 64-bit targets, are represented internally using a modular type with the appropriate number of bits, and thus the same lack of restriction applies. For example, if you declare: @@ -19296,30 +19300,30 @@ for R'Size use 49; then a component clause for a component of type @code{R} may start on any specified bit boundary, and may specify a value of 49 bits or greater. -For packed bit arrays that are longer than 64 bits, there are two -cases. If the component size is a power of 2 (1,2,4,8,16,32 bits), -including the important case of single bits or boolean values, then -there are no limitations on placement of such components, and they -may start and end at arbitrary bit boundaries. +For packed bit arrays that are longer than 64 bits on 32-bit targets, +and longer than 128 bits on 64-bit targets, there are two cases. If the +component size is a power of 2 (1,2,4,8,16,32,64 bits), including the +important case of single bits or boolean values, then there are no +limitations on placement of such components, and they may start and +end at arbitrary bit boundaries. -If the component size is not a power of 2 (e.g., 3 or 5), then -an array of this type longer than 64 bits must always be placed on -on a storage unit (byte) boundary and occupy an integral number -of storage units (bytes). Any component clause that does not -meet this requirement will be rejected. +If the component size is not a power of 2 (e.g., 3 or 5), then an array +of this type must always be placed on on a storage unit (byte) boundary +and occupy an integral number of storage units (bytes). Any component +clause that does not meet this requirement will be rejected. -Any aliased component, or component of an aliased type, must -have its normal alignment and size. A component clause that -does not meet this requirement will be rejected. +Any aliased component, or component of an aliased type, must have its +normal alignment and size. A component clause that does not meet this +requirement will be rejected. The tag field of a tagged type always occupies an address sized field at the start of the record. No component clause may attempt to overlay this tag. When a tagged type appears as a component, the tag field must have proper alignment -In the case of a record extension @code{T1}, of a type @code{T}, no component clause applied -to the type @code{T1} can specify a storage location that would overlap the first -@code{T'Size} bytes of the record. +In the case of a record extension @code{T1}, of a type @code{T}, no component +clause applied to the type @code{T1} can specify a storage location that +would overlap the first @code{T'Object_Size} bits of the record. For all other component types, including non-bit-packed arrays, the component can be placed at an arbitrary bit boundary, @@ -19350,8 +19354,7 @@ end record; @geindex Handling of Records with Holes As a result of alignment considerations, records may contain "holes" -or gaps -which do not correspond to the data bits of any of the components. +or gaps which do not correspond to the data bits of any of the components. Record representation clauses can also result in holes in records. GNAT does not attempt to clear these holes, so in record objects, diff --git a/gcc/ada/libgnat/i-cexten__128.ads b/gcc/ada/libgnat/i-cexten__128.ads new file mode 100644 index 00000000000..0c049f37471 --- /dev/null +++ b/gcc/ada/libgnat/i-cexten__128.ads @@ -0,0 +1,851 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT COMPILER COMPONENTS -- +-- -- +-- I N T E R F A C E S . C . E X T E N S I O N S -- +-- -- +-- S p e c -- +-- -- +-- Copyright (C) 1992-2020, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 3, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- +-- or FITNESS FOR A PARTICULAR PURPOSE. -- +-- -- +-- As a special exception under Section 7 of GPL version 3, you are granted -- +-- additional permissions described in the GCC Runtime Library Exception, -- +-- version 3.1, as published by the Free Software Foundation. -- +-- -- +-- You should have received a copy of the GNU General Public License and -- +-- a copy of the GCC Runtime Library Exception along with this program; -- +-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- +-- . -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- This package contains additional C-related definitions, intended for use +-- with either manually or automatically generated bindings to C libraries. + +with System; + +package Interfaces.C.Extensions is + pragma Pure; + + -- Definitions for C "void" and "void *" types + + subtype void is System.Address; + subtype void_ptr is System.Address; + + -- Definitions for C incomplete/unknown structs + + subtype opaque_structure_def is System.Address; + type opaque_structure_def_ptr is access opaque_structure_def; + for opaque_structure_def_ptr'Storage_Size use 0; + + -- Definitions for C++ incomplete/unknown classes + + subtype incomplete_class_def is System.Address; + type incomplete_class_def_ptr is access incomplete_class_def; + for incomplete_class_def_ptr'Storage_Size use 0; + + -- C bool + + type bool is new Boolean; + pragma Convention (C, bool); + + -- 64-bit integer types + + subtype long_long is Interfaces.C.long_long; + subtype unsigned_long_long is Interfaces.C.unsigned_long_long; + + -- 128-bit floating-point type available on x86: + -- typedef float float_128 __attribute__ ((mode (TF))); + + type Float_128 is record + low, high : unsigned_long_long; + end record; + pragma Convention (C_Pass_By_Copy, Float_128); + for Float_128'Alignment use unsigned_long_long'Alignment * 2; + + -- 128-bit complex floating-point type available on x86: + -- typedef _Complex float cfloat_128 __attribute__ ((mode (TC))); + + type CFloat_128 is record + re, im : Float_128; + end record; + pragma Convention (C_Pass_By_Copy, CFloat_128); + + -- Types for bitfields + + type Unsigned_1 is mod 2 ** 1; + for Unsigned_1'Size use 1; + + type Unsigned_2 is mod 2 ** 2; + for Unsigned_2'Size use 2; + + type Unsigned_3 is mod 2 ** 3; + for Unsigned_3'Size use 3; + + type Unsigned_4 is mod 2 ** 4; + for Unsigned_4'Size use 4; + + type Unsigned_5 is mod 2 ** 5; + for Unsigned_5'Size use 5; + + type Unsigned_6 is mod 2 ** 6; + for Unsigned_6'Size use 6; + + type Unsigned_7 is mod 2 ** 7; + for Unsigned_7'Size use 7; + + type Unsigned_8 is mod 2 ** 8; + for Unsigned_8'Size use 8; + + type Unsigned_9 is mod 2 ** 9; + for Unsigned_9'Size use 9; + + type Unsigned_10 is mod 2 ** 10; + for Unsigned_10'Size use 10; + + type Unsigned_11 is mod 2 ** 11; + for Unsigned_11'Size use 11; + + type Unsigned_12 is mod 2 ** 12; + for Unsigned_12'Size use 12; + + type Unsigned_13 is mod 2 ** 13; + for Unsigned_13'Size use 13; + + type Unsigned_14 is mod 2 ** 14; + for Unsigned_14'Size use 14; + + type Unsigned_15 is mod 2 ** 15; + for Unsigned_15'Size use 15; + + type Unsigned_16 is mod 2 ** 16; + for Unsigned_16'Size use 16; + + type Unsigned_17 is mod 2 ** 17; + for Unsigned_17'Size use 17; + + type Unsigned_18 is mod 2 ** 18; + for Unsigned_18'Size use 18; + + type Unsigned_19 is mod 2 ** 19; + for Unsigned_19'Size use 19; + + type Unsigned_20 is mod 2 ** 20; + for Unsigned_20'Size use 20; + + type Unsigned_21 is mod 2 ** 21; + for Unsigned_21'Size use 21; + + type Unsigned_22 is mod 2 ** 22; + for Unsigned_22'Size use 22; + + type Unsigned_23 is mod 2 ** 23; + for Unsigned_23'Size use 23; + + type Unsigned_24 is mod 2 ** 24; + for Unsigned_24'Size use 24; + + type Unsigned_25 is mod 2 ** 25; + for Unsigned_25'Size use 25; + + type Unsigned_26 is mod 2 ** 26; + for Unsigned_26'Size use 26; + + type Unsigned_27 is mod 2 ** 27; + for Unsigned_27'Size use 27; + + type Unsigned_28 is mod 2 ** 28; + for Unsigned_28'Size use 28; + + type Unsigned_29 is mod 2 ** 29; + for Unsigned_29'Size use 29; + + type Unsigned_30 is mod 2 ** 30; + for Unsigned_30'Size use 30; + + type Unsigned_31 is mod 2 ** 31; + for Unsigned_31'Size use 31; + + type Unsigned_32 is mod 2 ** 32; + for Unsigned_32'Size use 32; + + type Unsigned_33 is mod 2 ** 33; + for Unsigned_33'Size use 33; + + type Unsigned_34 is mod 2 ** 34; + for Unsigned_34'Size use 34; + + type Unsigned_35 is mod 2 ** 35; + for Unsigned_35'Size use 35; + + type Unsigned_36 is mod 2 ** 36; + for Unsigned_36'Size use 36; + + type Unsigned_37 is mod 2 ** 37; + for Unsigned_37'Size use 37; + + type Unsigned_38 is mod 2 ** 38; + for Unsigned_38'Size use 38; + + type Unsigned_39 is mod 2 ** 39; + for Unsigned_39'Size use 39; + + type Unsigned_40 is mod 2 ** 40; + for Unsigned_40'Size use 40; + + type Unsigned_41 is mod 2 ** 41; + for Unsigned_41'Size use 41; + + type Unsigned_42 is mod 2 ** 42; + for Unsigned_42'Size use 42; + + type Unsigned_43 is mod 2 ** 43; + for Unsigned_43'Size use 43; + + type Unsigned_44 is mod 2 ** 44; + for Unsigned_44'Size use 44; + + type Unsigned_45 is mod 2 ** 45; + for Unsigned_45'Size use 45; + + type Unsigned_46 is mod 2 ** 46; + for Unsigned_46'Size use 46; + + type Unsigned_47 is mod 2 ** 47; + for Unsigned_47'Size use 47; + + type Unsigned_48 is mod 2 ** 48; + for Unsigned_48'Size use 48; + + type Unsigned_49 is mod 2 ** 49; + for Unsigned_49'Size use 49; + + type Unsigned_50 is mod 2 ** 50; + for Unsigned_50'Size use 50; + + type Unsigned_51 is mod 2 ** 51; + for Unsigned_51'Size use 51; + + type Unsigned_52 is mod 2 ** 52; + for Unsigned_52'Size use 52; + + type Unsigned_53 is mod 2 ** 53; + for Unsigned_53'Size use 53; + + type Unsigned_54 is mod 2 ** 54; + for Unsigned_54'Size use 54; + + type Unsigned_55 is mod 2 ** 55; + for Unsigned_55'Size use 55; + + type Unsigned_56 is mod 2 ** 56; + for Unsigned_56'Size use 56; + + type Unsigned_57 is mod 2 ** 57; + for Unsigned_57'Size use 57; + + type Unsigned_58 is mod 2 ** 58; + for Unsigned_58'Size use 58; + + type Unsigned_59 is mod 2 ** 59; + for Unsigned_59'Size use 59; + + type Unsigned_60 is mod 2 ** 60; + for Unsigned_60'Size use 60; + + type Unsigned_61 is mod 2 ** 61; + for Unsigned_61'Size use 61; + + type Unsigned_62 is mod 2 ** 62; + for Unsigned_62'Size use 62; + + type Unsigned_63 is mod 2 ** 63; + for Unsigned_63'Size use 63; + + type Unsigned_64 is mod 2 ** 64; + for Unsigned_64'Size use 64; + + type Unsigned_65 is mod 2 ** 65; + for Unsigned_65'Size use 65; + + type Unsigned_66 is mod 2 ** 66; + for Unsigned_66'Size use 66; + + type Unsigned_67 is mod 2 ** 67; + for Unsigned_67'Size use 67; + + type Unsigned_68 is mod 2 ** 68; + for Unsigned_68'Size use 68; + + type Unsigned_69 is mod 2 ** 69; + for Unsigned_69'Size use 69; + + type Unsigned_70 is mod 2 ** 70; + for Unsigned_70'Size use 70; + + type Unsigned_71 is mod 2 ** 71; + for Unsigned_71'Size use 71; + + type Unsigned_72 is mod 2 ** 72; + for Unsigned_72'Size use 72; + + type Unsigned_73 is mod 2 ** 73; + for Unsigned_73'Size use 73; + + type Unsigned_74 is mod 2 ** 74; + for Unsigned_74'Size use 74; + + type Unsigned_75 is mod 2 ** 75; + for Unsigned_75'Size use 75; + + type Unsigned_76 is mod 2 ** 76; + for Unsigned_76'Size use 76; + + type Unsigned_77 is mod 2 ** 77; + for Unsigned_77'Size use 77; + + type Unsigned_78 is mod 2 ** 78; + for Unsigned_78'Size use 78; + + type Unsigned_79 is mod 2 ** 79; + for Unsigned_79'Size use 79; + + type Unsigned_80 is mod 2 ** 80; + for Unsigned_80'Size use 80; + + type Unsigned_81 is mod 2 ** 81; + for Unsigned_81'Size use 81; + + type Unsigned_82 is mod 2 ** 82; + for Unsigned_82'Size use 82; + + type Unsigned_83 is mod 2 ** 83; + for Unsigned_83'Size use 83; + + type Unsigned_84 is mod 2 ** 84; + for Unsigned_84'Size use 84; + + type Unsigned_85 is mod 2 ** 85; + for Unsigned_85'Size use 85; + + type Unsigned_86 is mod 2 ** 86; + for Unsigned_86'Size use 86; + + type Unsigned_87 is mod 2 ** 87; + for Unsigned_87'Size use 87; + + type Unsigned_88 is mod 2 ** 88; + for Unsigned_88'Size use 88; + + type Unsigned_89 is mod 2 ** 89; + for Unsigned_89'Size use 89; + + type Unsigned_90 is mod 2 ** 90; + for Unsigned_90'Size use 90; + + type Unsigned_91 is mod 2 ** 91; + for Unsigned_91'Size use 91; + + type Unsigned_92 is mod 2 ** 92; + for Unsigned_92'Size use 92; + + type Unsigned_93 is mod 2 ** 93; + for Unsigned_93'Size use 93; + + type Unsigned_94 is mod 2 ** 94; + for Unsigned_94'Size use 94; + + type Unsigned_95 is mod 2 ** 95; + for Unsigned_95'Size use 95; + + type Unsigned_96 is mod 2 ** 96; + for Unsigned_96'Size use 96; + + type Unsigned_97 is mod 2 ** 97; + for Unsigned_97'Size use 97; + + type Unsigned_98 is mod 2 ** 98; + for Unsigned_98'Size use 98; + + type Unsigned_99 is mod 2 ** 99; + for Unsigned_99'Size use 99; + + type Unsigned_100 is mod 2 ** 100; + for Unsigned_100'Size use 100; + + type Unsigned_101 is mod 2 ** 101; + for Unsigned_101'Size use 101; + + type Unsigned_102 is mod 2 ** 102; + for Unsigned_102'Size use 102; + + type Unsigned_103 is mod 2 ** 103; + for Unsigned_103'Size use 103; + + type Unsigned_104 is mod 2 ** 104; + for Unsigned_104'Size use 104; + + type Unsigned_105 is mod 2 ** 105; + for Unsigned_105'Size use 105; + + type Unsigned_106 is mod 2 ** 106; + for Unsigned_106'Size use 106; + + type Unsigned_107 is mod 2 ** 107; + for Unsigned_107'Size use 107; + + type Unsigned_108 is mod 2 ** 108; + for Unsigned_108'Size use 108; + + type Unsigned_109 is mod 2 ** 109; + for Unsigned_109'Size use 109; + + type Unsigned_110 is mod 2 ** 110; + for Unsigned_110'Size use 110; + + type Unsigned_111 is mod 2 ** 111; + for Unsigned_111'Size use 111; + + type Unsigned_112 is mod 2 ** 112; + for Unsigned_112'Size use 112; + + type Unsigned_113 is mod 2 ** 113; + for Unsigned_113'Size use 113; + + type Unsigned_114 is mod 2 ** 114; + for Unsigned_114'Size use 114; + + type Unsigned_115 is mod 2 ** 115; + for Unsigned_115'Size use 115; + + type Unsigned_116 is mod 2 ** 116; + for Unsigned_116'Size use 116; + + type Unsigned_117 is mod 2 ** 117; + for Unsigned_117'Size use 117; + + type Unsigned_118 is mod 2 ** 118; + for Unsigned_118'Size use 118; + + type Unsigned_119 is mod 2 ** 119; + for Unsigned_119'Size use 119; + + type Unsigned_120 is mod 2 ** 120; + for Unsigned_120'Size use 120; + + type Unsigned_121 is mod 2 ** 121; + for Unsigned_121'Size use 121; + + type Unsigned_122 is mod 2 ** 122; + for Unsigned_122'Size use 122; + + type Unsigned_123 is mod 2 ** 123; + for Unsigned_123'Size use 123; + + type Unsigned_124 is mod 2 ** 124; + for Unsigned_124'Size use 124; + + type Unsigned_125 is mod 2 ** 125; + for Unsigned_125'Size use 125; + + type Unsigned_126 is mod 2 ** 126; + for Unsigned_126'Size use 126; + + type Unsigned_127 is mod 2 ** 127; + for Unsigned_127'Size use 127; + + type Unsigned_128 is mod 2 ** 128; + for Unsigned_128'Size use 128; + + type Signed_2 is range -2 ** 1 .. 2 ** 1 - 1; + for Signed_2'Size use 2; + + type Signed_3 is range -2 ** 2 .. 2 ** 2 - 1; + for Signed_3'Size use 3; + + type Signed_4 is range -2 ** 3 .. 2 ** 3 - 1; + for Signed_4'Size use 4; + + type Signed_5 is range -2 ** 4 .. 2 ** 4 - 1; + for Signed_5'Size use 5; + + type Signed_6 is range -2 ** 5 .. 2 ** 5 - 1; + for Signed_6'Size use 6; + + type Signed_7 is range -2 ** 6 .. 2 ** 6 - 1; + for Signed_7'Size use 7; + + type Signed_8 is range -2 ** 7 .. 2 ** 7 - 1; + for Signed_8'Size use 8; + + type Signed_9 is range -2 ** 8 .. 2 ** 8 - 1; + for Signed_9'Size use 9; + + type Signed_10 is range -2 ** 9 .. 2 ** 9 - 1; + for Signed_10'Size use 10; + + type Signed_11 is range -2 ** 10 .. 2 ** 10 - 1; + for Signed_11'Size use 11; + + type Signed_12 is range -2 ** 11 .. 2 ** 11 - 1; + for Signed_12'Size use 12; + + type Signed_13 is range -2 ** 12 .. 2 ** 12 - 1; + for Signed_13'Size use 13; + + type Signed_14 is range -2 ** 13 .. 2 ** 13 - 1; + for Signed_14'Size use 14; + + type Signed_15 is range -2 ** 14 .. 2 ** 14 - 1; + for Signed_15'Size use 15; + + type Signed_16 is range -2 ** 15 .. 2 ** 15 - 1; + for Signed_16'Size use 16; + + type Signed_17 is range -2 ** 16 .. 2 ** 16 - 1; + for Signed_17'Size use 17; + + type Signed_18 is range -2 ** 17 .. 2 ** 17 - 1; + for Signed_18'Size use 18; + + type Signed_19 is range -2 ** 18 .. 2 ** 18 - 1; + for Signed_19'Size use 19; + + type Signed_20 is range -2 ** 19 .. 2 ** 19 - 1; + for Signed_20'Size use 20; + + type Signed_21 is range -2 ** 20 .. 2 ** 20 - 1; + for Signed_21'Size use 21; + + type Signed_22 is range -2 ** 21 .. 2 ** 21 - 1; + for Signed_22'Size use 22; + + type Signed_23 is range -2 ** 22 .. 2 ** 22 - 1; + for Signed_23'Size use 23; + + type Signed_24 is range -2 ** 23 .. 2 ** 23 - 1; + for Signed_24'Size use 24; + + type Signed_25 is range -2 ** 24 .. 2 ** 24 - 1; + for Signed_25'Size use 25; + + type Signed_26 is range -2 ** 25 .. 2 ** 25 - 1; + for Signed_26'Size use 26; + + type Signed_27 is range -2 ** 26 .. 2 ** 26 - 1; + for Signed_27'Size use 27; + + type Signed_28 is range -2 ** 27 .. 2 ** 27 - 1; + for Signed_28'Size use 28; + + type Signed_29 is range -2 ** 28 .. 2 ** 28 - 1; + for Signed_29'Size use 29; + + type Signed_30 is range -2 ** 29 .. 2 ** 29 - 1; + for Signed_30'Size use 30; + + type Signed_31 is range -2 ** 30 .. 2 ** 30 - 1; + for Signed_31'Size use 31; + + type Signed_32 is range -2 ** 31 .. 2 ** 31 - 1; + for Signed_32'Size use 32; + + type Signed_33 is range -2 ** 32 .. 2 ** 32 - 1; + for Signed_33'Size use 33; + + type Signed_34 is range -2 ** 33 .. 2 ** 33 - 1; + for Signed_34'Size use 34; + + type Signed_35 is range -2 ** 34 .. 2 ** 34 - 1; + for Signed_35'Size use 35; + + type Signed_36 is range -2 ** 35 .. 2 ** 35 - 1; + for Signed_36'Size use 36; + + type Signed_37 is range -2 ** 36 .. 2 ** 36 - 1; + for Signed_37'Size use 37; + + type Signed_38 is range -2 ** 37 .. 2 ** 37 - 1; + for Signed_38'Size use 38; + + type Signed_39 is range -2 ** 38 .. 2 ** 38 - 1; + for Signed_39'Size use 39; + + type Signed_40 is range -2 ** 39 .. 2 ** 39 - 1; + for Signed_40'Size use 40; + + type Signed_41 is range -2 ** 40 .. 2 ** 40 - 1; + for Signed_41'Size use 41; + + type Signed_42 is range -2 ** 41 .. 2 ** 41 - 1; + for Signed_42'Size use 42; + + type Signed_43 is range -2 ** 42 .. 2 ** 42 - 1; + for Signed_43'Size use 43; + + type Signed_44 is range -2 ** 43 .. 2 ** 43 - 1; + for Signed_44'Size use 44; + + type Signed_45 is range -2 ** 44 .. 2 ** 44 - 1; + for Signed_45'Size use 45; + + type Signed_46 is range -2 ** 45 .. 2 ** 45 - 1; + for Signed_46'Size use 46; + + type Signed_47 is range -2 ** 46 .. 2 ** 46 - 1; + for Signed_47'Size use 47; + + type Signed_48 is range -2 ** 47 .. 2 ** 47 - 1; + for Signed_48'Size use 48; + + type Signed_49 is range -2 ** 48 .. 2 ** 48 - 1; + for Signed_49'Size use 49; + + type Signed_50 is range -2 ** 49 .. 2 ** 49 - 1; + for Signed_50'Size use 50; + + type Signed_51 is range -2 ** 50 .. 2 ** 50 - 1; + for Signed_51'Size use 51; + + type Signed_52 is range -2 ** 51 .. 2 ** 51 - 1; + for Signed_52'Size use 52; + + type Signed_53 is range -2 ** 52 .. 2 ** 52 - 1; + for Signed_53'Size use 53; + + type Signed_54 is range -2 ** 53 .. 2 ** 53 - 1; + for Signed_54'Size use 54; + + type Signed_55 is range -2 ** 54 .. 2 ** 54 - 1; + for Signed_55'Size use 55; + + type Signed_56 is range -2 ** 55 .. 2 ** 55 - 1; + for Signed_56'Size use 56; + + type Signed_57 is range -2 ** 56 .. 2 ** 56 - 1; + for Signed_57'Size use 57; + + type Signed_58 is range -2 ** 57 .. 2 ** 57 - 1; + for Signed_58'Size use 58; + + type Signed_59 is range -2 ** 58 .. 2 ** 58 - 1; + for Signed_59'Size use 59; + + type Signed_60 is range -2 ** 59 .. 2 ** 59 - 1; + for Signed_60'Size use 60; + + type Signed_61 is range -2 ** 60 .. 2 ** 60 - 1; + for Signed_61'Size use 61; + + type Signed_62 is range -2 ** 61 .. 2 ** 61 - 1; + for Signed_62'Size use 62; + + type Signed_63 is range -2 ** 62 .. 2 ** 62 - 1; + for Signed_63'Size use 63; + + type Signed_64 is range -2 ** 63 .. 2 ** 63 - 1; + for Signed_64'Size use 64; + + type Signed_65 is range -2 ** 64 .. 2 ** 64 - 1; + for Signed_65'Size use 65; + + type Signed_66 is range -2 ** 65 .. 2 ** 65 - 1; + for Signed_66'Size use 66; + + type Signed_67 is range -2 ** 66 .. 2 ** 66 - 1; + for Signed_67'Size use 67; + + type Signed_68 is range -2 ** 67 .. 2 ** 67 - 1; + for Signed_68'Size use 68; + + type Signed_69 is range -2 ** 68 .. 2 ** 68 - 1; + for Signed_69'Size use 69; + + type Signed_70 is range -2 ** 69 .. 2 ** 69 - 1; + for Signed_70'Size use 70; + + type Signed_71 is range -2 ** 70 .. 2 ** 70 - 1; + for Signed_71'Size use 71; + + type Signed_72 is range -2 ** 71 .. 2 ** 71 - 1; + for Signed_72'Size use 72; + + type Signed_73 is range -2 ** 72 .. 2 ** 72 - 1; + for Signed_73'Size use 73; + + type Signed_74 is range -2 ** 73 .. 2 ** 73 - 1; + for Signed_74'Size use 74; + + type Signed_75 is range -2 ** 74 .. 2 ** 74 - 1; + for Signed_75'Size use 75; + + type Signed_76 is range -2 ** 75 .. 2 ** 75 - 1; + for Signed_76'Size use 76; + + type Signed_77 is range -2 ** 76 .. 2 ** 76 - 1; + for Signed_77'Size use 77; + + type Signed_78 is range -2 ** 77 .. 2 ** 77 - 1; + for Signed_78'Size use 78; + + type Signed_79 is range -2 ** 78 .. 2 ** 78 - 1; + for Signed_79'Size use 79; + + type Signed_80 is range -2 ** 79 .. 2 ** 79 - 1; + for Signed_80'Size use 80; + + type Signed_81 is range -2 ** 80 .. 2 ** 80 - 1; + for Signed_81'Size use 81; + + type Signed_82 is range -2 ** 81 .. 2 ** 81 - 1; + for Signed_82'Size use 82; + + type Signed_83 is range -2 ** 82 .. 2 ** 82 - 1; + for Signed_83'Size use 83; + + type Signed_84 is range -2 ** 83 .. 2 ** 83 - 1; + for Signed_84'Size use 84; + + type Signed_85 is range -2 ** 84 .. 2 ** 84 - 1; + for Signed_85'Size use 85; + + type Signed_86 is range -2 ** 85 .. 2 ** 85 - 1; + for Signed_86'Size use 86; + + type Signed_87 is range -2 ** 86 .. 2 ** 86 - 1; + for Signed_87'Size use 87; + + type Signed_88 is range -2 ** 87 .. 2 ** 87 - 1; + for Signed_88'Size use 88; + + type Signed_89 is range -2 ** 88 .. 2 ** 88 - 1; + for Signed_89'Size use 89; + + type Signed_90 is range -2 ** 89 .. 2 ** 89 - 1; + for Signed_90'Size use 90; + + type Signed_91 is range -2 ** 90 .. 2 ** 90 - 1; + for Signed_91'Size use 91; + + type Signed_92 is range -2 ** 91 .. 2 ** 91 - 1; + for Signed_92'Size use 92; + + type Signed_93 is range -2 ** 92 .. 2 ** 92 - 1; + for Signed_93'Size use 93; + + type Signed_94 is range -2 ** 93 .. 2 ** 93 - 1; + for Signed_94'Size use 94; + + type Signed_95 is range -2 ** 94 .. 2 ** 94 - 1; + for Signed_95'Size use 95; + + type Signed_96 is range -2 ** 95 .. 2 ** 95 - 1; + for Signed_96'Size use 96; + + type Signed_97 is range -2 ** 96 .. 2 ** 96 - 1; + for Signed_97'Size use 97; + + type Signed_98 is range -2 ** 97 .. 2 ** 97 - 1; + for Signed_98'Size use 98; + + type Signed_99 is range -2 ** 98 .. 2 ** 98 - 1; + for Signed_99'Size use 99; + + type Signed_100 is range -2 ** 99 .. 2 ** 99 - 1; + for Signed_100'Size use 100; + + type Signed_101 is range -2 ** 100 .. 2 ** 100 - 1; + for Signed_101'Size use 101; + + type Signed_102 is range -2 ** 101 .. 2 ** 101 - 1; + for Signed_102'Size use 102; + + type Signed_103 is range -2 ** 102 .. 2 ** 102 - 1; + for Signed_103'Size use 103; + + type Signed_104 is range -2 ** 103 .. 2 ** 103 - 1; + for Signed_104'Size use 104; + + type Signed_105 is range -2 ** 104 .. 2 ** 104 - 1; + for Signed_105'Size use 105; + + type Signed_106 is range -2 ** 105 .. 2 ** 105 - 1; + for Signed_106'Size use 106; + + type Signed_107 is range -2 ** 106 .. 2 ** 106 - 1; + for Signed_107'Size use 107; + + type Signed_108 is range -2 ** 107 .. 2 ** 107 - 1; + for Signed_108'Size use 108; + + type Signed_109 is range -2 ** 108 .. 2 ** 108 - 1; + for Signed_109'Size use 109; + + type Signed_110 is range -2 ** 109 .. 2 ** 109 - 1; + for Signed_110'Size use 110; + + type Signed_111 is range -2 ** 110 .. 2 ** 110 - 1; + for Signed_111'Size use 111; + + type Signed_112 is range -2 ** 111 .. 2 ** 111 - 1; + for Signed_112'Size use 112; + + type Signed_113 is range -2 ** 112 .. 2 ** 112 - 1; + for Signed_113'Size use 113; + + type Signed_114 is range -2 ** 113 .. 2 ** 113 - 1; + for Signed_114'Size use 114; + + type Signed_115 is range -2 ** 114 .. 2 ** 114 - 1; + for Signed_115'Size use 115; + + type Signed_116 is range -2 ** 115 .. 2 ** 115 - 1; + for Signed_116'Size use 116; + + type Signed_117 is range -2 ** 116 .. 2 ** 116 - 1; + for Signed_117'Size use 117; + + type Signed_118 is range -2 ** 117 .. 2 ** 117 - 1; + for Signed_118'Size use 118; + + type Signed_119 is range -2 ** 118 .. 2 ** 118 - 1; + for Signed_119'Size use 119; + + type Signed_120 is range -2 ** 119 .. 2 ** 119 - 1; + for Signed_120'Size use 120; + + type Signed_121 is range -2 ** 120 .. 2 ** 120 - 1; + for Signed_121'Size use 121; + + type Signed_122 is range -2 ** 121 .. 2 ** 121 - 1; + for Signed_122'Size use 122; + + type Signed_123 is range -2 ** 122 .. 2 ** 122 - 1; + for Signed_123'Size use 123; + + type Signed_124 is range -2 ** 123 .. 2 ** 123 - 1; + for Signed_124'Size use 124; + + type Signed_125 is range -2 ** 124 .. 2 ** 124 - 1; + for Signed_125'Size use 125; + + type Signed_126 is range -2 ** 125 .. 2 ** 125 - 1; + for Signed_126'Size use 126; + + type Signed_127 is range -2 ** 126 .. 2 ** 126 - 1; + for Signed_127'Size use 127; + + type Signed_128 is range -2 ** 127 .. 2 ** 127 - 1; + for Signed_128'Size use 128; + +end Interfaces.C.Extensions; diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb index 0851307cd2d..e086a5d9d2b 100644 --- a/gcc/ada/switch-c.adb +++ b/gcc/ada/switch-c.adb @@ -844,28 +844,6 @@ package body Switch.C is Disable_Switch_Storing; Ptr := Ptr + 1; - -- -gnate128 (Enable 128-bit types) - - when '1' => - if Ptr = Max then - Bad_Switch ("-gnate1"); - end if; - - Ptr := Ptr + 1; - - if Switch_Chars (Ptr) /= '2' then - Bad_Switch ("-gnate1" & Switch_Chars (Ptr .. Max)); - end if; - - Ptr := Ptr + 1; - - if Switch_Chars (Ptr) /= '8' then - Bad_Switch ("-gnate12" & Switch_Chars (Ptr .. Max)); - end if; - - Enable_128bit_Types := True; - Ptr := Ptr + 1; - -- All other -gnate? switches are unassigned when others => diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb index 133e34fd7ce..f9864842d52 100644 --- a/gcc/ada/usage.adb +++ b/gcc/ada/usage.adb @@ -270,11 +270,6 @@ begin -- No line for -gnatez : internal switch - -- Line for -gnate128 switch - - Write_Switch_Char ("e128"); - Write_Line ("Enable support for 128-bit types"); - -- Line for -gnatE switch Write_Switch_Char ("E"); diff --git a/gcc/testsuite/ada/acats/run_all.sh b/gcc/testsuite/ada/acats/run_all.sh index 764598398a2..ac2a86bea6c 100755 --- a/gcc/testsuite/ada/acats/run_all.sh +++ b/gcc/testsuite/ada/acats/run_all.sh @@ -133,6 +133,23 @@ target_run $dir/support/impbit > $dir/support/impbit.out 2>&1 target_bit=`cat $dir/support/impbit.out` echo target_bit="$target_bit" >> $dir/acats.log +case "$target_bit" in + *32*) + target_max_int="9223372036854775807" + target_min_int="-9223372036854775808" + ;; + *64*) + target_max_int="170141183460469231731687303715884105727" + target_min_int="-170141183460469231731687303715884105728" + ;; + *) + display "**** Unsupported bits per word" + exit 1 +esac + +echo target_max_insn="$target_max_int" >> $dir/acats.log +echo target_min_insn="$target_min_int" >> $dir/acats.log + # Find out a suitable asm statement # Adapted from configure.ac gcc_cv_as_dwarf2_debug_line case "$target" in @@ -153,6 +170,8 @@ sed -e "s,ACATS4GNATDIR,$dir,g" \ sed -e "s,ACATS4GNATDIR,$dir,g" \ -e "s,ACATS4GNATBIT,$target_bit,g" \ -e "s,ACATS4GNATINSN,$target_insn,g" \ + -e "s,ACATS4GNATMAXINT,$target_max_int,g" \ + -e "s,ACATS4GNATMININT,$target_min_int,g" \ < $testdir/support/macro.dfs > $dir/support/MACRO.DFS sed -e "s,ACATS4GNATDIR,$dir,g" \ < $testdir/support/tsttests.dat > $dir/support/TSTTESTS.DAT diff --git a/gcc/testsuite/ada/acats/support/macro.dfs b/gcc/testsuite/ada/acats/support/macro.dfs index 8c3723348ad..e3c55596f25 100644 --- a/gcc/testsuite/ada/acats/support/macro.dfs +++ b/gcc/testsuite/ada/acats/support/macro.dfs @@ -227,7 +227,7 @@ MACHINE_CODE_STATEMENT Asm_Insn'(Asm ("ACATS4GNATINSN")); -- THE LITERAL MUST NOT INCLUDE UNDERSCORES OR LEADING OR TRAILING -- BLANKS. -- USED IN: C35503D C35503F C4A007A -MAX_INT 9223372036854775807 +MAX_INT ACATS4GNATMAXINT -- $MIN_INT @@ -235,7 +235,7 @@ MAX_INT 9223372036854775807 -- THE LITERAL MUST NOT CONTAIN UNDERSCORES OR LEADING OR TRAILING -- BLANKS. -- USED IN: C35503D C35503F -MIN_INT -9223372036854775808 +MIN_INT ACATS4GNATMININT -- $NAME -- THE NAME OF A PREDEFINED INTEGER TYPE OTHER THAN INTEGER, diff --git a/gcc/testsuite/gnat.dg/assert1.adb b/gcc/testsuite/gnat.dg/assert1.adb index d761cd0d990..7a40d3c23d0 100644 --- a/gcc/testsuite/gnat.dg/assert1.adb +++ b/gcc/testsuite/gnat.dg/assert1.adb @@ -2,8 +2,9 @@ -- { dg-options "-gnatws" } pragma Assertion_Policy (Check); -with Text_IO; use Text_IO; + procedure assert1 is + Int128 : constant Boolean := Standard'Max_Integer_Size = 128; type p1 is array (1 .. 113) of Boolean; pragma Pack (p1); type p2 is array (1 .. 13) of Boolean; @@ -19,21 +20,21 @@ procedure assert1 is v3 : p3; v4 : p4; begin - pragma Assert (p1'Size = 120); + pragma Assert (p1'Size = (if Int128 then 113 else 120)); pragma Assert (p2'Size = 13); pragma Assert (p3'Size = 113); pragma Assert (p4'Size = 13); - pragma Assert (p1'Value_Size = 120); + pragma Assert (p1'Value_Size = (if Int128 then 113 else 120)); pragma Assert (p2'Value_Size = 13); pragma Assert (p3'Value_Size = 113); pragma Assert (p4'Value_Size = 13); - pragma Assert (p1'Object_Size = 120); + pragma Assert (p1'Object_Size = (if Int128 then 128 else 120)); pragma Assert (p2'Object_Size = 16); - pragma Assert (p3'Object_Size = 120); + pragma Assert (p3'Object_Size = (if Int128 then 128 else 120)); pragma Assert (p4'Object_Size = 16); - pragma Assert (v1'Size = 120); + pragma Assert (v1'Size = (if Int128 then 128 else 120)); pragma Assert (v2'Size = 16); - pragma Assert (v3'Size = 120); + pragma Assert (v3'Size = (if Int128 then 128 else 120)); pragma Assert (v4'Size = 16); null; end; diff --git a/gcc/testsuite/gnat.dg/size_clause1.adb b/gcc/testsuite/gnat.dg/size_clause1.adb index fc090eb9409..0a313bf6461 100644 --- a/gcc/testsuite/gnat.dg/size_clause1.adb +++ b/gcc/testsuite/gnat.dg/size_clause1.adb @@ -4,7 +4,7 @@ procedure Size_Clause1 is for Modular'Size use 64; subtype Enlarged_Modular is Modular; - for Enlarged_Modular'Object_Size use 128; -- { dg-warning "warning: 64 bits of \"Enlarged_Modular\" unused" } + for Enlarged_Modular'Object_Size use 128; -- { dg-warning "64 bits of \"Enlarged_Modular\" unused" "" { target { ! lp64 } } } begin null; diff --git a/gcc/testsuite/gnat.dg/specs/rep_clause5.ads b/gcc/testsuite/gnat.dg/specs/rep_clause5.ads index ffac17b3c29..3e1ff4d62e6 100644 --- a/gcc/testsuite/gnat.dg/specs/rep_clause5.ads +++ b/gcc/testsuite/gnat.dg/specs/rep_clause5.ads @@ -33,6 +33,7 @@ package Rep_Clause5 is type Array_2_Type is array (0 .. 127) of Boolean; for Array_2_Type'size use 128; + for Array_2_Type'Alignment use 4; type Array_3_Type is array (0 .. 31) of Boolean; for Array_3_Type'size use 32; diff --git a/gcc/testsuite/gnat.dg/warn11.adb b/gcc/testsuite/gnat.dg/warn11.adb index e92835f0533..7e6f1a19e95 100644 --- a/gcc/testsuite/gnat.dg/warn11.adb +++ b/gcc/testsuite/gnat.dg/warn11.adb @@ -5,7 +5,7 @@ with Ada.Text_IO; use Ada.Text_IO; procedure Warn11 is type My_Integer is new Integer range 1 .. 10; - for My_Integer'Size use 65; -- { dg-warning "unused" } + for My_Integer'Size use 65; -- { dg-warning "unused" "" { target { ! lp64 } } } type My_Integer2 is new Integer range 1 .. 10; for My_Integer2'Size use 129; -- { dg-warning "unused" }