The previous patch has exposed a latent issue: we sometimes set some flags on a
DECL node using information that come from another entity.
Tested on i586-suse-linux, applied on the mainline.
2012-03-07 Eric Botcazou <ebotca...@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity): Do not set flags on the
DECL node built for a type which has a non-trivial equivalent type.
--- gcc-interface/decl.c (revision 185075)
+++ gcc-interface/decl.c (working copy)
@@ -5061,9 +5061,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
/* If we really have a ..._DECL node, set a couple of flags on it. But we
- cannot do so if we are reusing the ..._DECL node made for an alias or a
- renamed object as the predicates don't apply to it but to GNAT_ENTITY. */
+ cannot do so if we are reusing the ..._DECL node made for an equivalent
+ type or an alias or a renamed object as the predicates don't apply to it
+ but to GNAT_ENTITY. */
if (DECL_P (gnu_decl)
+ && !(is_type && gnat_equiv_type != gnat_entity)
&& !Present (Alias (gnat_entity))
&& !(Present (Renamed_Object (gnat_entity)) && saved))