public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/100989] New: Bogus internal VOLATILE attribute for ASYNCHRONOUS
@ 2021-06-09  9:05 burnus at gcc dot gnu.org
  2021-06-09 16:18 ` [Bug fortran/100989] " tkoenig at gcc dot gnu.org
  2021-06-09 16:19 ` tkoenig at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-06-09  9:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100989
           Summary: Bogus internal VOLATILE attribute for ASYNCHRONOUS
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: tkoenig at gcc dot gnu.org
  Target Milestone: ---

For a long time, there was the believe that due to GCC's pointer-escape
semantic, which follows C, no special attribute is needed for asynchronous:


  ...
  integer, asynchronous :: A
  call init_action(A)  ! pointer escape due to by-ref and GCC's C semantic 
  ...                  ! and due to 'asynchronous' due to Fortran semantic
  A = 5   ! (probably a bad idea if really asynchronous)
  ...
  call wait()   ! arrives here, can access A due to escaped pointer
  ! <-- value of 'A' could have changed

There might be an issue with the handling of the 'fn attr', though as the
variables have to be regarded as escaping for certain function calls.

In any case, VOLATILE prevents too much optimizations.

The volatile was added by commit:
  commit 2b4c90656132abb8b8ad155d345c7d4fbf1687c9
via
  https://gcc.gnu.org/pipermail/gcc-patches/2018-June/499870.html
  https://gcc.gnu.org/pipermail/gcc-patches/2018-August/503896.html
without any discussion of this point.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/100989] Bogus internal VOLATILE attribute for ASYNCHRONOUS
  2021-06-09  9:05 [Bug fortran/100989] New: Bogus internal VOLATILE attribute for ASYNCHRONOUS burnus at gcc dot gnu.org
@ 2021-06-09 16:18 ` tkoenig at gcc dot gnu.org
  2021-06-09 16:19 ` tkoenig at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2021-06-09 16:18 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-06-09
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |WAITING

--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
F2018, 8.5.4:

" An entity with the ASYNCHRONOUS attribute is a variable, and may be subject
to asynchronous input/output or asynchronous communication."

So, the variable can be changed without going through normal program
flow.  A pointer marked as escaping isn't enough, because there can
also be a change during code which does not invoke any other procedures.
(such as by an MPI call).

If volatile isn't the right model, what is?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/100989] Bogus internal VOLATILE attribute for ASYNCHRONOUS
  2021-06-09  9:05 [Bug fortran/100989] New: Bogus internal VOLATILE attribute for ASYNCHRONOUS burnus at gcc dot gnu.org
  2021-06-09 16:18 ` [Bug fortran/100989] " tkoenig at gcc dot gnu.org
@ 2021-06-09 16:19 ` tkoenig at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2021-06-09 16:19 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-09 16:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09  9:05 [Bug fortran/100989] New: Bogus internal VOLATILE attribute for ASYNCHRONOUS burnus at gcc dot gnu.org
2021-06-09 16:18 ` [Bug fortran/100989] " tkoenig at gcc dot gnu.org
2021-06-09 16:19 ` tkoenig 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).