From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [205.232.38.15]) by sourceware.org (Postfix) with ESMTP id C05D73984060 for ; Thu, 29 Apr 2021 08:03:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C05D73984060 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=derodat@adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id D7923561BF; Thu, 29 Apr 2021 04:03:47 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id XrmS60eBZYAY; Thu, 29 Apr 2021 04:03:47 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [205.232.38.10]) by rock.gnat.com (Postfix) with ESMTP id C5BEF561B9; Thu, 29 Apr 2021 04:03:47 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4862) id C5016193; Thu, 29 Apr 2021 04:03:47 -0400 (EDT) Date: Thu, 29 Apr 2021 04:03:47 -0400 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [Ada] Fix internal consistency error with Duration and 32-bit target file Message-ID: <20210429080347.GA133974@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="BOKacYhQ+x31HxR3" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Apr 2021 08:03:55 -0000 --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. --BOKacYhQ+x31HxR3 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" 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). --BOKacYhQ+x31HxR3--