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.