File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -5967,10 +5967,27 @@ class FirConverter : public Fortran::lower::AbstractConverter {
59675967 Fortran::lower::pft::getScopeVariableListMap (mod);
59685968 for (const auto &var : Fortran::lower::pft::getScopeVariableList (
59695969 mod.getScope (), scopeVariableListMap)) {
5970+
59705971 // Only define the variables owned by this module.
59715972 const Fortran::semantics::Scope *owningScope = var.getOwningScope ();
5972- if (!owningScope || mod.getScope () == *owningScope)
5973- Fortran::lower::defineModuleVariable (*this , var);
5973+ if (owningScope && mod.getScope () != *owningScope)
5974+ continue ;
5975+
5976+ // Very special case: The value of numeric_storage_size depends on
5977+ // compilation options and therefore its value is not yet known when
5978+ // building the builtins runtime. Instead, the parameter is folding a
5979+ // __numeric_storage_size() expression which is loaded into the user
5980+ // program. For the iso_fortran_env object file, omit the symbol as it
5981+ // is never used.
5982+ if (var.hasSymbol ()) {
5983+ const Fortran::semantics::Symbol &sym = var.getSymbol ();
5984+ const Fortran::semantics::Scope &owner = sym.owner ();
5985+ if (sym.name () == " numeric_storage_size" && owner.IsModule () &&
5986+ DEREF (owner.symbol ()).name () == " iso_fortran_env" )
5987+ continue ;
5988+ }
5989+
5990+ Fortran::lower::defineModuleVariable (*this , var);
59745991 }
59755992 for (auto &eval : mod.evaluationList )
59765993 genFIR (eval);
You can’t perform that action at this time.
0 commit comments