re PR fortran/25716 (FAIL: gfortran.dg/char_result_11.f90 -O (test for excess errors))

fortran/
2005-01-25  Erik Edelmann  <eedelman@gcc.gnu.org>

        PR fortran/25716
        * symbol.c (free_old_symbol): New function.
        (gfc_commit_symbols): Use it.
        (gfc_commit_symbol): New function.
        (gfc_use_derived): Use it.
        * gfortran.h: Add prototype for gfc_commit_symbol.
        * intrinsic.c (gfc_find_function): Search in 'conversion'
        if not found in 'functions'.
        (gfc_convert_type_warn): Add a symtree to the new
        expression node, and commit the new symtree->n.sym.
        * resolve.c (gfc_resolve_index): Make sure typespec is
        properly initialized.

testsuite/
2005-01-25  Erik Edelmann  <eedelman@gcc.gnu.org>

        PR fortran/25716
        * gfortran.dg/char_result_11.f90: Make it sensitive to PR
        25716 on 32-bit systems too.

From-SVN: r110225
This commit is contained in:
Erik Edelmann 2006-01-25 20:46:29 +00:00
parent 5c45cecb25
commit 810306f2c5
7 changed files with 95 additions and 20 deletions

View File

@ -1,3 +1,18 @@
2005-01-25 Erik Edelmann <eedelman@gcc.gnu.org>
PR fortran/25716
* symbol.c (free_old_symbol): New function.
(gfc_commit_symbols): Use it.
(gfc_commit_symbol): New function.
(gfc_use_derived): Use it.
* gfortran.h: Add prototype for gfc_commit_symbol.
* intrinsic.c (gfc_find_function): Search in 'conversion'
if not found in 'functions'.
(gfc_convert_type_warn): Add a symtree to the new
expression node, and commit the new symtree->n.sym.
* resolve.c (gfc_resolve_index): Make sure typespec is
properly initialized.
2005-01-23 Paul Thomas <pault@gcc.gnu.org>
PR fortran/25901

View File

@ -1771,6 +1771,7 @@ int gfc_symbols_could_alias (gfc_symbol *, gfc_symbol *);
void gfc_undo_symbols (void);
void gfc_commit_symbols (void);
void gfc_commit_symbol (gfc_symbol * sym);
void gfc_free_namespace (gfc_namespace *);
void gfc_symbol_init_2 (void);

View File

@ -711,8 +711,13 @@ find_sym (gfc_intrinsic_sym * start, int n, const char *name)
gfc_intrinsic_sym *
gfc_find_function (const char *name)
{
gfc_intrinsic_sym *sym;
return find_sym (functions, nfunc, name);
sym = find_sym (functions, nfunc, name);
if (!sym)
sym = find_sym (conversion, nconv, name);
return sym;
}
@ -3415,6 +3420,16 @@ gfc_convert_type_warn (gfc_expr * expr, gfc_typespec * ts, int eflag,
new->rank = rank;
new->shape = gfc_copy_shape (shape, rank);
gfc_get_ha_sym_tree (sym->name, &new->symtree);
new->symtree->n.sym->ts = *ts;
new->symtree->n.sym->attr.flavor = FL_PROCEDURE;
new->symtree->n.sym->attr.function = 1;
new->symtree->n.sym->attr.intrinsic = 1;
new->symtree->n.sym->attr.elemental = 1;
new->symtree->n.sym->attr.pure = 1;
new->symtree->n.sym->attr.referenced = 1;
gfc_commit_symbol (new->symtree->n.sym);
*expr = *new;
gfc_free (new);

View File

@ -2088,6 +2088,7 @@ gfc_resolve_index (gfc_expr * index, int check_scalar)
if (index->ts.kind != gfc_index_integer_kind
|| index->ts.type != BT_INTEGER)
{
gfc_clear_ts (&ts);
ts.type = BT_INTEGER;
ts.kind = gfc_index_integer_kind;

View File

@ -1345,7 +1345,7 @@ switch_types (gfc_symtree * st, gfc_symbol * from, gfc_symbol * to)
gfc_symbol *
gfc_use_derived (gfc_symbol * sym)
{
gfc_symbol *s, *p;
gfc_symbol *s;
gfc_typespec *t;
gfc_symtree *st;
int i;
@ -1379,15 +1379,7 @@ gfc_use_derived (gfc_symbol * sym)
s->refs++;
/* Unlink from list of modified symbols. */
if (changed_syms == sym)
changed_syms = sym->tlink;
else
for (p = changed_syms; p; p = p->tlink)
if (p->tlink == sym)
{
p->tlink = sym->tlink;
break;
}
gfc_commit_symbol (sym);
switch_types (sym->ns->sym_root, sym, s);
@ -2238,6 +2230,26 @@ gfc_undo_symbols (void)
}
/* Free sym->old_symbol. sym->old_symbol is mostly a shallow copy of sym; but
few components might have been given new values. */
static void
free_old_symbol (gfc_symbol * sym)
{
if (sym->old_symbol == NULL)
return;
if (sym->old_symbol->as != sym->as)
gfc_free_array_spec (sym->old_symbol->as);
if (sym->old_symbol->value != sym->value)
gfc_free_expr (sym->old_symbol->value);
gfc_free (sym->old_symbol);
sym->old_symbol = NULL;
}
/* Makes the changes made in the current statement permanent-- gets
rid of undo information. */
@ -2253,14 +2265,37 @@ gfc_commit_symbols (void)
p->mark = 0;
p->new = 0;
if (p->old_symbol != NULL)
{
gfc_free (p->old_symbol);
p->old_symbol = NULL;
}
free_old_symbol (p);
}
changed_syms = NULL;
}
/* Makes the changes made in one symbol permanent -- gets rid of undo
information. */
void
gfc_commit_symbol (gfc_symbol * sym)
{
gfc_symbol *p;
if (changed_syms == sym)
changed_syms = sym->tlink;
else
{
for (p = changed_syms; p; p = p->tlink)
if (p->tlink == sym)
{
p->tlink = sym->tlink;
break;
}
}
changed_syms = NULL;
sym->tlink = NULL;
sym->mark = 0;
sym->new = 0;
free_old_symbol (sym);
}

View File

@ -1,3 +1,9 @@
2005-01-25 Erik Edelmann <eedelman@gcc.gnu.org>
PR fortran/25716
* gfortran.dg/char_result_11.f90: Make it sensitive to PR
25716 on 32-bit systems too.
2006-01-25 Kazu Hirata <kazu@codesourcery.com>
PR testsuite/25590

View File

@ -1,5 +1,6 @@
! { dg-do compile }
! PR 23675: Character function of module variable length
! { dg-do link }
! PR 23675: Character function of module-variable length
! PR 25716: Implicit kind conversions in in expressions written to *.mod-files.
module cutils
implicit none
@ -11,7 +12,8 @@ module cutils
end type t
integer :: m1 = 25, m2 = 25, m3 = 25, m4 = 25, m5 = 25
integer :: n1 = 3, n2 = 3, n3 = 3, n4 = 3, n5 = 3, n6 = 3, n7 = 3, n8 = 3, n9 = 3
integer :: n5 = 3, n7 = 3, n9 = 3
integer(1) :: n1 = 3, n2 = 3, n3 = 3, n4 = 3, n6 = 3, n8 = 3
character(10) :: s = "abcdefghij"
integer :: x(4) = (/ 30, 40, 50, 60 /)
type(t) :: tt1(5), tt2(5)