The attached patch fixes PR fortran/91066. The original code was feeding a nonsense string of tokens to the assembler causing it to toss its cookies. It turns out that gfortran was not enforcing the constraint C1547 from Fortran 2018. The attached patch now performs that check. Regression tested on x86_64-*-freebsd. OK to commit? 2019-04-19 Steven G. Kargl PR fortran/90166 * decl.c (in_module_or_interface): New function to check that the current state is in a module, submodule, or interface. (gfc_match_prefix): Use it. PR fortran/90166 * gfortran.dg/submodule_22.f08: Add additional dg-error comments. -- Steve