public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/106336] New: BLOCK construct and host association are not handled correctlyThis
@ 2022-07-18  1:47 kargl at gcc dot gnu.org
  2022-07-18 16:01 ` [Bug fortran/106336] BLOCK construct and host association are not handled correctly kargl at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: kargl at gcc dot gnu.org @ 2022-07-18  1:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106336
           Summary: BLOCK construct and host association are not handled
                    correctlyThis
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kargl at gcc dot gnu.org
  Target Milestone: ---

This program

   program foo
   x = 1
   print  *, x
   block
     x = x + 1
     print *, x
     data x/41/
   end block
   print *, x
   end program foo

should print

   1.0000
   42.000
   1.0000


F2018: C876  (R839) A variable whose designator appears as a data-stmt-object
   ... shall not be ... accessed by ... host association, in a named common
   block unless the DATA statement is in a block data program unit, in blank
   common, a function name, a function result name, an automatic data  object,
   or an allocatable variable.

The DATA statement causes explicit initialization at the start of
execution, and if I understand C876 it blocks host association.  That
is, the 'x' in the block construct has local scope.

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

* [Bug fortran/106336] BLOCK construct and host association are not handled correctly
  2022-07-18  1:47 [Bug fortran/106336] New: BLOCK construct and host association are not handled correctlyThis kargl at gcc dot gnu.org
@ 2022-07-18 16:01 ` kargl at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: kargl at gcc dot gnu.org @ 2022-07-18 16:01 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from kargl at gcc dot gnu.org ---
Upon further investigation, the issue is not a host association issue as there
is no host association in the program.  The block construct is in the inclusive
scope of the program unit.  Thus, there is name association.  There seems to be
an issue with the standard with regards to the `data` statement in block
construct.  For now, closing this.

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

end of thread, other threads:[~2022-07-18 16:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-18  1:47 [Bug fortran/106336] New: BLOCK construct and host association are not handled correctlyThis kargl at gcc dot gnu.org
2022-07-18 16:01 ` [Bug fortran/106336] BLOCK construct and host association are not handled correctly kargl 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).