This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Untabified and resubmitted: Patch to gfortran PR13742
- From: Steven Bosscher <stevenb at suse dot de>
- To: Victor Leikehman <LEI at il dot ibm dot com>, gcc-patches at gcc dot gnu dot org,fortran at gcc dot gnu dot org
- Date: Wed, 5 May 2004 13:56:09 +0200
- Subject: Re: Untabified and resubmitted: Patch to gfortran PR13742
- Organization: SUSE Labs
- References: <OF8D596F6B.4EEA0E1D-ON43256E8B.0029B5E8-43256E8B.002A5E89@il.ibm.com>
On Wednesday 05 May 2004 09:42, Victor Leikehman wrote:
> @@ -179,13 +180,18 @@ static tree
> build_equiv_decl (tree union_type, bool is_init)
> {
> tree decl;
> +
> + if (is_init)
> + {
> + decl = gfc_create_var (union_type, "equiv");
> + TREE_STATIC (decl) = 1;
> + return decl;
> + }
> +
> decl = build_decl (VAR_DECL, NULL, union_type);
> DECL_ARTIFICIAL (decl) = 1;
>
> - if (is_init)
> - DECL_COMMON (decl) = 0;
> - else
> - DECL_COMMON (decl) = 1;
> + DECL_COMMON (decl) = 1;
This put all EQUIVALENCE decls in '.common', I doubt we really want that.
> if (sym)
> - decl = build_common_decl (sym, union_type, is_init);
> + {
> + if (is_init)
> + gfc_error ("Variables in COMMON block should not"
> + " have initializers");
Is there a way to get this error to the front end?
The idea always was to have the front end handle all errors/warnings,
and have the backend generate code iff no errors were found.
> + if (h->sym->value)
> + {
> + if (h->offset < offset)
> + gfc_error ("Unsupported form of initialization"
> + " of EQUIVALENCEd variables");
This should use sorry().
> + /* Sanity check */
> + for (t = CONSTRUCTOR_ELTS (ctor); t; t = TREE_CHAIN (t))
> + {
> + tree field = TREE_PURPOSE (t);
> + assert (TREE_CODE (field) == FIELD_DECL);
> + }
This can be wrapped in #ifdef ENABLE_CHECKING/#endif.
Gr.
Steven