re PR fortran/32147 (Module file change due to order of writting out changes)

fortran/
PR fortran/32147
* module.c (write_symbol): Fix whitespace.
(write_symbol0): Walk symtree from left-to-right instead
breadth-first.
(write_symbol1): Similarly change walk of pointer info tree.
(write_module): Insert linebreak.
* symbol.c (gfc_traverse_symtree): Change to left-to-right order.
(traverse_ns): Likewise.

testsuite/
PR fortran/32147
* gfortran.dg/module_md5_1.f90: Update hash-value.

From-SVN: r129701
This commit is contained in:
Tobias Schlüter 2007-10-28 19:53:27 +01:00
parent 6f17d116b7
commit 5cb4180570
5 changed files with 53 additions and 31 deletions

View File

@ -1,3 +1,14 @@
2007-10-28 Tobias Schlüter <tobi@gcc.gnu.org>
PR fortran/32147
* module.c (write_symbol): Fix whitespace.
(write_symbol0): Walk symtree from left-to-right instead
breadth-first.
(write_symbol1): Similarly change walk of pointer info tree.
(write_module): Insert linebreak.
* symbol.c (gfc_traverse_symtree): Change to left-to-right order.
(traverse_ns): Likewise.
2007-10-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/31306

View File

@ -3880,7 +3880,7 @@ write_equiv (void)
static void
write_symbol (int n, gfc_symbol *sym)
{
const char *label;
const char *label;
if (sym->attr.flavor == FL_UNKNOWN || sym->attr.flavor == FL_LABEL)
gfc_internal_error ("write_symbol(): bad module symbol '%s'", sym->name);
@ -3913,12 +3913,12 @@ write_symbol0 (gfc_symtree *st)
{
gfc_symbol *sym;
pointer_info *p;
bool dont_write = false;
if (st == NULL)
return;
write_symbol0 (st->left);
write_symbol0 (st->right);
sym = st->n.sym;
if (sym->module == NULL)
@ -3926,20 +3926,25 @@ write_symbol0 (gfc_symtree *st)
if (sym->attr.flavor == FL_PROCEDURE && sym->attr.generic
&& !sym->attr.subroutine && !sym->attr.function)
return;
dont_write = true;
if (!gfc_check_access (sym->attr.access, sym->ns->default_access))
return;
dont_write = true;
p = get_pointer (sym);
if (p->type == P_UNKNOWN)
p->type = P_SYMBOL;
if (!dont_write)
{
p = get_pointer (sym);
if (p->type == P_UNKNOWN)
p->type = P_SYMBOL;
if (p->u.wsym.state == WRITTEN)
return;
if (p->u.wsym.state != WRITTEN)
{
write_symbol (p->integer, sym);
p->u.wsym.state = WRITTEN;
}
}
write_symbol (p->integer, sym);
p->u.wsym.state = WRITTEN;
write_symbol0 (st->right);
}
@ -3953,22 +3958,22 @@ write_symbol0 (gfc_symtree *st)
static int
write_symbol1 (pointer_info *p)
{
int result;
if (p == NULL)
if (!p)
return 0;
if (write_symbol1 (p->left))
return 1;
if (write_symbol1 (p->right))
return 1;
result = write_symbol1 (p->left);
if (p->type != P_SYMBOL || p->u.wsym.state != NEEDS_WRITE)
return 0;
if (!(p->type != P_SYMBOL || p->u.wsym.state != NEEDS_WRITE))
{
p->u.wsym.state = WRITTEN;
write_symbol (p->integer, p->u.wsym.sym);
result = 1;
}
p->u.wsym.state = WRITTEN;
write_symbol (p->integer, p->u.wsym.sym);
return 1;
result |= write_symbol1 (p->right);
return result;
}
@ -4103,7 +4108,8 @@ write_module (void)
mio_lparen ();
write_symbol0 (gfc_current_ns->sym_root);
while (write_symbol1 (pi_root));
while (write_symbol1 (pi_root))
/* Nothing. */;
mio_rparen ();

View File

@ -2927,13 +2927,12 @@ clear_sym_mark (gfc_symtree *st)
void
gfc_traverse_symtree (gfc_symtree *st, void (*func) (gfc_symtree *))
{
if (st != NULL)
{
(*func) (st);
if (!st)
return;
gfc_traverse_symtree (st->left, func);
gfc_traverse_symtree (st->right, func);
}
gfc_traverse_symtree (st->left, func);
(*func) (st);
gfc_traverse_symtree (st->right, func);
}
@ -2946,11 +2945,12 @@ traverse_ns (gfc_symtree *st, void (*func) (gfc_symbol *))
if (st == NULL)
return;
traverse_ns (st->left, func);
if (st->n.sym->mark == 0)
(*func) (st->n.sym);
st->n.sym->mark = 1;
traverse_ns (st->left, func);
traverse_ns (st->right, func);
}

View File

@ -1,3 +1,8 @@
2007-10-28 Tobias Schlüter <tobi@gcc.gnu.org>
PR fortran/32147
* gfortran.dg/module_md5_1.f90: Update hash-value.
2007-10-28 Andrew Pinski <pinskia@gmail.com>
PR tree-opt/33589

View File

@ -10,5 +10,5 @@ program test
use foo
print *, pi
end program test
! { dg-final { scan-module "foo" "MD5:22d65c2e261759ab63cb7db9d0a8882b" } }
! { dg-final { scan-module "foo" "MD5:2350094d1d87eb25ab22af5f8e96e011" } }
! { dg-final { cleanup-modules "foo" } }