From 74250065e2402e80c5b2a69e251104f67e8ebd10 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Sat, 14 Jan 2012 13:04:20 +0100 Subject: re PR fortran/51816 (Wrong error when use..., only : operator() twice) 2011-01-14 Tobias Burnus PR fortran/51816 * module.c (read_module): Don't make nonexisting intrinsic operators as found. (rename_list_remove_duplicate): New function. (gfc_use_modules): Use it. 2011-01-14 Tobias Burnus PR fortran/51816 * gfortran.dg/use_18.f90: New. * gfortran.dg/use_19.f90: New. From-SVN: r183179 --- gcc/fortran/module.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'gcc/fortran/module.c') diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index a681325..0616a85 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -4465,7 +4465,7 @@ read_module (void) int i; int ambiguous, j, nuse, symbol; pointer_info *info, *q; - gfc_use_rename *u; + gfc_use_rename *u = NULL; gfc_symtree *st; gfc_symbol *sym; @@ -4678,6 +4678,8 @@ read_module (void) } mio_interface (&gfc_current_ns->op[i]); + if (u && !gfc_current_ns->op[i]) + u->found = 0; } mio_rparen (); @@ -6093,6 +6095,31 @@ gfc_use_module (gfc_use_list *module) } +/* Remove duplicated intrinsic operators from the rename list. */ + +static void +rename_list_remove_duplicate (gfc_use_rename *list) +{ + gfc_use_rename *seek, *last; + + for (; list; list = list->next) + if (list->op != INTRINSIC_USER && list->op != INTRINSIC_NONE) + { + last = list; + for (seek = list->next; seek; seek = last->next) + { + if (list->op == seek->op) + { + last->next = seek->next; + free (seek); + } + else + last = seek; + } + } +} + + /* Process all USE directives. */ void @@ -6171,6 +6198,7 @@ gfc_use_modules (void) for (; module_list; module_list = next) { next = module_list->next; + rename_list_remove_duplicate (module_list->rename); gfc_use_module (module_list); if (module_list->intrinsic) free_rename (module_list->rename); -- cgit v1.1