From fac519741f39f1741dbf5c88dfc2a8b8e90d0007 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Thu, 7 Sep 2017 15:33:29 +0000 Subject: [PATCH] re PR ada/82127 (gnat.dg/specs/constructor.ads FAILs) PR ada/82127 * gcc-interface/decl.c (copy_and_substitute_in_layout): Put the fields in order of increasing position in more cases. From-SVN: r251846 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/gcc-interface/decl.c | 8 +++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index eb6fe7ad554..94224d60783 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +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. + 2017-09-07 Yannick Moy * a-exetim-mingw.ads: Add contract Global=>null diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 8514d9a5a0a..baa925999fa 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -9530,12 +9530,10 @@ copy_and_substitute_in_layout (Entity_Id gnat_new_type, 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; -- 2.30.2