OK, this is it (I hope). Finding the different parts where location information was missing is now complete (I hope), at least the testsuite passes with the addition of the warnings. I had a bit more time than expected today, so I split this up the way I did.
I will submit a patch soon to always run the check for locus information when checking is enabled. Regards Thomas 2016-11-07 Thomas Koenig <tkoe...@gcc.gnu.org> PR fortran/78226 * expr.c (gfc_generate_initializer): Add where to EXPR_NULL statement. * iresolve.c (gfc_resolve_extends_type_of): Add where to both arguments of the function. * resolve.c (resolve_select_type): Add where to the second argument of the new statement.
Index: expr.c =================================================================== --- expr.c (Revision 241887) +++ expr.c (Arbeitskopie) @@ -4367,6 +4367,7 @@ gfc_generate_initializer (gfc_typespec *ts, bool g { ctor->expr = gfc_get_expr (); ctor->expr->expr_type = EXPR_NULL; + ctor->expr->where = init->where; ctor->expr->ts = comp->ts; } Index: iresolve.c =================================================================== --- iresolve.c (Revision 241887) +++ iresolve.c (Arbeitskopie) @@ -1044,9 +1044,12 @@ gfc_resolve_extends_type_of (gfc_expr *f, gfc_expr gfc_add_vptr_component (a); else if (a->ts.type == BT_DERIVED) { + locus where; + vtab = gfc_find_derived_vtab (a->ts.u.derived); /* Clear the old expr. */ gfc_free_ref_list (a->ref); + where = a->where; memset (a, '\0', sizeof (gfc_expr)); /* Construct a new one. */ a->expr_type = EXPR_VARIABLE; @@ -1053,6 +1056,7 @@ gfc_resolve_extends_type_of (gfc_expr *f, gfc_expr st = gfc_find_symtree (vtab->ns->sym_root, vtab->name); a->symtree = st; a->ts = vtab->ts; + a->where = where; } /* Replace the second argument with the corresponding vtab. */ @@ -1060,8 +1064,11 @@ gfc_resolve_extends_type_of (gfc_expr *f, gfc_expr gfc_add_vptr_component (mo); else if (mo->ts.type == BT_DERIVED) { + locus where; + vtab = gfc_find_derived_vtab (mo->ts.u.derived); /* Clear the old expr. */ + where = mo->where; gfc_free_ref_list (mo->ref); memset (mo, '\0', sizeof (gfc_expr)); /* Construct a new one. */ @@ -1069,6 +1076,7 @@ gfc_resolve_extends_type_of (gfc_expr *f, gfc_expr st = gfc_find_symtree (vtab->ns->sym_root, vtab->name); mo->symtree = st; mo->ts = vtab->ts; + mo->where = where; } f->ts.type = BT_LOGICAL; Index: resolve.c =================================================================== --- resolve.c (Revision 241909) +++ resolve.c (Arbeitskopie) @@ -8863,6 +8863,7 @@ resolve_select_type (gfc_code *code, gfc_namespace st = gfc_find_symtree (vtab->ns->sym_root, vtab->name); new_st->expr1->value.function.actual->next = gfc_get_actual_arglist (); new_st->expr1->value.function.actual->next->expr = gfc_get_variable_expr (st); + new_st->expr1->value.function.actual->next->expr->where = code->loc; new_st->next = body->next; } if (default_case->next)