public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Fix internal consistency error with Duration and 32-bit target file
@ 2021-04-29  8:03 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-04-29  8:03 UTC (permalink / raw)
  To: gcc-patches; +Cc: Eric Botcazou

[-- Attachment #1: Type: text/plain, Size: 434 bytes --]

The Duration type of package Standard can be either a 32-bit or a 64-bit
fixed-point type depending on a flag in the system.ads file, but it needs
to be 32-bit when a target configuration file sets a 32-bit size for all
the predefined integer types.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* gnat1drv.adb (Adjust_Global_Switches): Force a 32-bit Duration
	type if the maximum integer size is lower than 64 bits.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 654 bytes --]

diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb
--- a/gcc/ada/gnat1drv.adb
+++ b/gcc/ada/gnat1drv.adb
@@ -819,6 +819,12 @@ procedure Gnat1drv is
            Ttypes.Standard_Long_Long_Integer_Size;
       end if;
 
+      --  Forcefully use a 32-bit Duration with only 32-bit integer types
+
+      if Ttypes.System_Max_Integer_Size < 64 then
+         Targparm.Duration_32_Bits_On_Target := True;
+      end if;
+
       --  Finally capture adjusted value of Suppress_Options as the initial
       --  value for Scope_Suppress, which will be modified as we move from
       --  scope to scope (by Suppress/Unsuppress/Overflow_Checks pragmas).



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-29  8:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29  8:03 [Ada] Fix internal consistency error with Duration and 32-bit target file Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).