This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: walking a namespace to check a symbol name?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]