This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran, OOP] PR 44541: wrong code for polymorphic variable with INTENT(OUT)/Alloc w/ MOLD


Janus Weil wrote:
I don't see what you mean. The intention here was to check the
'referenced' attribute only for non-dummies, but anyway ...

Sorry, I misread that part. I think your patch makes sense - but for some reason it does not seem to be required.


For my example, the value is set via: resolve_fl_variable -> resolve_fl_variable_derived, which contains:

  /* Assign default initializer.  */
  if (!(sym->value || sym->attr.pointer || sym->attr.allocatable)
&& (!no_init_flag || sym->attr.intent == INTENT_OUT))
    {
      sym->value = gfc_default_initializer (&sym->ts);
    }

Thus, I really wonder whether the resolve_symbol's version is used at all.

+  if (sym->ts.type == BT_CLASS&&  sym->ns == gfc_current_ns
+&&  sym->attr.dummy&&  sym->attr.intent == INTENT_OUT
+&&  !sym->attr.pointer&&  !sym->attr.allocatable)
+    apply_default_init (sym);
+
    /* If this symbol has a type-spec, check it.  */
    if (sym->attr.flavor == FL_VARIABLE || sym->attr.flavor == FL_PARAMETER
        || (sym->attr.flavor == FL_PROCEDURE&&  sym->attr.function))

OK - though one could think of plugging into the resolve_fl_variable or resolve_fl_variable_derived code.


Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]