This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/31204] wrong host association of implied loop variable
- From: "pault at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Apr 2007 11:49:48 -0000
- Subject: [Bug fortran/31204] wrong host association of implied loop variable
- References: <bug-31204-6642@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from pault at gcc dot gnu dot org 2007-04-06 12:49 -------
This fixes it and half regtests(I got bored with the time that it was taking
with Chug_chugwin.). I will regest tonight on something more spritely!
Paul
Index: gcc/fortran/decl.c
===================================================================
*** gcc/fortran/decl.c (révision 123517)
--- gcc/fortran/decl.c (copie de travail)
*************** build_sym (const char *name, gfc_charlen
*** 769,774 ****
--- 769,777 ----
if (gfc_copy_attr (&sym->attr, &attr, var_locus) == FAILURE)
return FAILURE;
+ /* Reset because symbol is not only declared implicitly as an implied
+ do loop index. */
+ sym->attr.implied_index = 0;
return SUCCESS;
}
Index: gcc/fortran/gfortran.h
===================================================================
*** gcc/fortran/gfortran.h (révision 123516)
--- gcc/fortran/gfortran.h (copie de travail)
*************** typedef struct
*** 483,489 ****
/* Variable attributes. */
unsigned allocatable:1, dimension:1, external:1, intrinsic:1,
optional:1, pointer:1, save:1, target:1, value:1, volatile_:1,
! dummy:1, result:1, assign:1, threadprivate:1, not_always_present:1;
unsigned data:1, /* Symbol is named in a DATA statement. */
protected:1, /* Symbol has been marked as protected. */
--- 483,490 ----
/* Variable attributes. */
unsigned allocatable:1, dimension:1, external:1, intrinsic:1,
optional:1, pointer:1, save:1, target:1, value:1, volatile_:1,
! dummy:1, result:1, assign:1, threadprivate:1, not_always_present:1,
! implied_index:1;
unsigned data:1, /* Symbol is named in a DATA statement. */
protected:1, /* Symbol has been marked as protected. */
Index: gcc/fortran/match.c
===================================================================
*** gcc/fortran/match.c (révision 123516)
--- gcc/fortran/match.c (copie de travail)
*************** gfc_match_iterator (gfc_iterator *iter,
*** 536,541 ****
--- 536,543 ----
goto cleanup;
}
+ var->symtree->n.sym->attr.implied_index = 1;
+
m = init_flag ? gfc_match_init_expr (&e1) : gfc_match_expr (&e1);
if (m == MATCH_NO)
goto syntax;
Index: gcc/fortran/primary.c
===================================================================
*** gcc/fortran/primary.c (révision 123516)
--- gcc/fortran/primary.c (copie de travail)
*************** gfc_match_rvalue (gfc_expr **result)
*** 2017,2023 ****
--- 2017,2038 ----
e = NULL;
where = gfc_current_locus;
+ /* If this is an implicit do loop index and implicitly typed,
+ it should not be host associated. */
+ if (sym->attr.flavor == FL_VARIABLE
+ && sym->ns != gfc_current_ns
+ && sym->attr.implied_index
+ && sym->attr.implicit_type
+ && !sym->attr.use_assoc)
+ {
+ i = gfc_get_sym_tree (name, NULL, &symtree);
+ if (i)
+ return MATCH_ERROR;
+ sym = symtree->n.sym;
+ }
+
gfc_set_sym_referenced (sym);
+ sym->attr.implied_index = 0;
if (sym->attr.function && sym->result == sym)
{
*************** match_variable (gfc_expr **result, int e
*** 2386,2391 ****
--- 2401,2424 ----
where = gfc_current_locus;
sym = st->n.sym;
+
+ /* If this is an implicit do loop index and implicitly typed,
+ it should not be host associated. */
+ if (sym->ns != gfc_current_ns
+ && sym->attr.implied_index
+ && sym->attr.implicit_type
+ && !sym->attr.use_assoc)
+ {
+ int i;
+
+ i = gfc_get_sym_tree (sym->name, NULL, &st);
+ if (i)
+ return MATCH_ERROR;
+ sym = st->n.sym;
+ }
+
+ sym->attr.implied_index = 0;
+
gfc_set_sym_referenced (sym);
switch (sym->attr.flavor)
{
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pault at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2007-03-16 20:53:01 |2007-04-06 12:49:48
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31204