walking a namespace to check a symbol name?

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Sun May 1 22:56:00 GMT 2005


Steve Kargl wrote:
> How does one walk a namespace to determine if a name
> has previous been used?  The following program is 
> illegal (see PR 21257)
> 
>    program f
>    integer i,j
>    loop: do i = 1, 5
>             print *, i
>          end do loop
>    loop: do j = 1, 5
>             print *, j
>          end do loop
>    end program f
> 
> because the do-construct-name is not unique (Thanks,
> Richard for forsing me to read 14.1.2(1) several times).
> Note, a similar problem also affects if-construct-name
> and case-construct-name via gfc_match_label() in match.c.

Sounds like you want to call gfc_find_symbol from gfc_match_do, giving an
error if the symbol already exists.

- Tobi



More information about the Fortran mailing list