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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110225
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
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);
gfc_intrinsic_sym *
gfc_find_function (const char *name)
{
+ gfc_intrinsic_sym *sym;
+
+ sym = find_sym (functions, nfunc, name);
+ if (!sym)
+ sym = find_sym (conversion, nconv, name);
- return find_sym (functions, nfunc, name);
+ return sym;
}
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);
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;
gfc_symbol *
gfc_use_derived (gfc_symbol * sym)
{
- gfc_symbol *s, *p;
+ gfc_symbol *s;
gfc_typespec *t;
gfc_symtree *st;
int i;
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);
}
+/* 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. */
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;
+ }
+ }
+
+ sym->tlink = NULL;
+ sym->mark = 0;
+ sym->new = 0;
+
+ free_old_symbol (sym);
+}
+
+
/* Recursive function that deletes an entire tree and all the common
head structures it points to. */
+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
-! { 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
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)