https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106035
--- Comment #15 from Paul Thomas <pault at gcc dot gnu.org> --- Wrongly pushed as pr106135 - sorry. Will correct wrong pr number tomorrow. The master branch has been updated by Paul Thomas <pa...@gcc.gnu.org>: https://gcc.gnu.org/g:743c04db2f93612845e6baa7dabf9e511c3cfd85 commit r16-2189-g743c04db2f93612845e6baa7dabf9e511c3cfd85 Author: Paul Thomas <pa...@gcc.gnu.org> Date: Fri Jul 11 08:28:27 2025 +0100 Fortran: Implement F2018 IMPORT statements [PR106135] 2025-09-09 Paul Thomas <pa...@gcc.gnu.org> gcc/fortran PR fortran/106135 * decl.cc (build_sym): Emit an error if a symbol associated by an IMPORT, ONLY or IMPORT, all statement is being redeclared. (gfc_match_import): Parse and check the F2018 versions of the IMPORT statement. For scopes other than and interface body, if the symbol cannot be found in the host scope, generate it and set it up such that gfc_fixup_sibling_symbols can transfer its 'imported attribute' if it turnes out to be a not yet parsed procedure. Test for violations of C897-8100. * gfortran.h : Add 'import_only' to the gfc_symtree structure. Add the enum, 'importstate', which is used for values the new field 'import_state' in gfc_namespace. * parse.cc (gfc_fixup_sibling_symbols): Transfer the attribute 'imported' to the new symbol. * resolve.cc (check_sym_import_status, check_import_status): New functions to test symbols and expressions for violations of F2018:C8102. (resolve_call): Test the 'resolved_sym' against C8102 by a call to 'check_sym_import_status'. (gfc_resolve_expr): If the expression is OK and an IMPORT statement has been registered in the current scope, test C102 by calling 'check_import_status'. (resolve_select_type): Test the declared derived type in TYPE IS and CLASS IS statements. gcc/testsuite/ PR fortran/106135 * gfortran.dg/import3.f90: Use -std=f2008 and comment on change in error message texts with f2018. * gfortran.dg/import12.f90: New test.