public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/88899] Derived type IO in conjunction with openmp fails with invalid memory read
       [not found] <bug-88899-4@http.gcc.gnu.org/bugzilla/>
@ 2021-03-12 15:28 ` burnus at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: burnus at gcc dot gnu.org @ 2021-03-12 15:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88899

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |pault at gcc dot gnu.org
           Keywords|                            |wrong-code

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The problem seems to be due to finalization.

integer(kind=4) __final_mod_T (...)
{
  static struct t * ptr2;
...
}

Calling this function concurrently fails as ptr2 is "static".


The reason for 'static' is:

#0  gfc_finish_var_decl (decl=0x7ffff71ac090, sym=0x2914580) at
../../repos/gcc/gcc/fortran/trans-decl.c:727

722       if (!sym->attr.use_assoc
723           && ((sym->ts.type == BT_DERIVED
724                && sym->ts.u.derived->attr.has_dtio_procs)
725               || (sym->ts.type == BT_CLASS
726                   && CLASS_DATA (sym)->ts.u.derived->attr.has_dtio_procs)))
727         TREE_STATIC (decl) = 1;


"ptr2" itself seems to come from class.c's finalizer_insert_packed_call.

 * * *

That change was part of the huge commit
https://gcc.gnu.org/g:e73d3ca6d1caf9c1187eeb1236dffd42f15ec043 for PR
fortran/48298 (DTIO).

The changelog states for this change:

            * trans-decl.c (gfc_finish_var_decl): If a derived-type/class
            object is associated with DTIO procedures, make it TREE_STATIC.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-12 15:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-88899-4@http.gcc.gnu.org/bugzilla/>
2021-03-12 15:28 ` [Bug fortran/88899] Derived type IO in conjunction with openmp fails with invalid memory read burnus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).