https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45187
Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fxcoudert at gcc dot gnu.org Summary|ICE with CRAY pointer in |ICE with CRAY pointer in |module depending on |module |variable name | --- Comment #2 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> --- Confirm on current trunk. Also, I have an idea why it depends on the variable name :) The ICE is observed with any variable name that is lexicographically smaller than "c_" (i.e., that sorts before "c_" in alphabetical order). I suppose we're trying to create backend decls for the POINTER in this order, and it fails when the variable has already been created before it. Since the error is a "checking" in gfc_create_module_variable(), and we probably simply need to bail out if the symbol is a Cray-pointee, here's a suggested patch: Index: trans-decl.c =================================================================== --- trans-decl.c (revision 211315) +++ trans-decl.c (working copy) @@ -4282,6 +4282,10 @@ gfc_create_module_variable (gfc_symbol * if (sym->attr.use_assoc || sym->attr.in_common) return; + /* Cray pointees will be created elsewhere. */ + if (sym->attr.cray_pointee) + return; + /* Equivalenced variables arrive here after creation. */ if (sym->backend_decl && (sym->equiv_built || sym->attr.in_equivalence))