From patchwork Thu Sep 7 15:33:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 811074 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-461688-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="BEHcwwHm"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xp4HL6JWvz9t2r for ; Fri, 8 Sep 2017 01:33:49 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=UOLnIKCN7b79Ky8V ypZstCC6VGhN2PG/BUMGrH/hnF1T+BftLow7jqUO2sO0Ckz+opbT3ASO148tZ9lf KIA8NytcclyG+GSl4wzTqxr2UIa4Vc/2/qYkSI2KzIKL5ZJSjIR28dd10tZYwAJs S60IPTfL/Fdz4kCH9d7lVMfMPOg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=PR38wrJJzyNzL2xeSCztOQ GIwyw=; b=BEHcwwHm+Cd1Vat36szj6Xxz5jal4+5lsZ8ZJyRrzxj+UgN2Lh91NJ os7/FpqLBIA53EYn6evxbuN3hO4sPZwBk6RmDE1cLdUlAXlgAWsaeMlPtVSTQdb+ e7cm1eCmEEL1j2cbYVqlVjLr7o/HXKtcIS1r1Vb1grmgBkZS4cvcw= Received: (qmail 111696 invoked by alias); 7 Sep 2017 15:33:41 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 111593 invoked by uid 89); 7 Sep 2017 15:33:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 07 Sep 2017 15:33:35 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id B321B82272 for ; Thu, 7 Sep 2017 17:33:32 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UB5eZmc3OohV for ; Thu, 7 Sep 2017 17:33:32 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 8EFE68200B for ; Thu, 7 Sep 2017 17:33:32 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Fix PR ada/82127 Date: Thu, 07 Sep 2017 17:33:32 +0200 Message-ID: <1841737.l7X6SNFtDL@polaris> User-Agent: KMail/4.14.10 (Linux/3.16.7-53-desktop; KDE/4.14.9; x86_64; ; ) MIME-Version: 1.0 A small oversight in the implementation of component reordering. Tested on x86_64-suse-linux, applied on mainline. 2017-09-07 Eric Botcazou PR ada/82127 * gcc-interface/decl.c (copy_and_substitute_in_layout): Put the fields in order of increasing position in more cases. Index: gcc-interface/decl.c =================================================================== --- gcc-interface/decl.c (revision 251812) +++ gcc-interface/decl.c (working copy) @@ -9530,12 +9530,10 @@ copy_and_substitute_in_layout (Entity_Id save_gnu_tree (gnat_field, gnu_field, false); } - /* If there is a variant list, a selected variant and the fields all have a + /* If there is no variant list or a selected variant and the fields all have constant position, put them in order of increasing position to match that - of constant CONSTRUCTORs. Likewise if there is no variant list but a REP - part, since the latter has been flattened in the process. */ - if ((gnu_variant_list.exists () ? selected_variant : gnu_rep_part != NULL) - && all_constant_pos) + of constant CONSTRUCTORs. */ + if ((!gnu_variant_list.exists () || selected_variant) && all_constant_pos) { const int len = list_length (gnu_field_list); tree *field_arr = XALLOCAVEC (tree, len), t = gnu_field_list;