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

Fritz Reese <foreese at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from Fritz Reese <foreese at gcc dot gnu.org> ---
(In reply to Steve Kargl from comment #4)
...
> 
>       program bug
>       structure /bckt/
>          union
>             map
>                character*16 c16
>             end map
>          end union
>       end structure
>       record /bckt/ bucket
>       character(len=16) :: rec1 = 'ABCDEFGHIJKLMNOP'
>   100 format(A16)
>       read(rec1, 100) bckt
>       end program bug
> 
> where one is trying read into the definition of the structure.
> Is the above suppose to compile?  Because it does.  [...]

Steve- on second glance, the above program is correct, even though it is
misleading. It compiles because there is no IMPLICIT NONE, so the variable BCKT
is an implicit variable created at the point of use. The program above behaves
equivalently if STRUCTURE /bckt/ is never declared, and issues an appropriate
error with IMPLICIT NONE:

        program bug
        implicit none
        structure /bckt/
        [...]
        read(rec1, 100) bckt
        end program bug

$ gfortran -fdec-structure bug.for
bug.for:12:26:

       read(rec1, 100) bckt
                          1
Error: Symbol ‘bckt’ at (1) has no IMPLICIT type

Reply via email to