walking a namespace to check a symbol name?

Steve Kargl sgk@troutmask.apl.washington.edu
Sun May 1 18:07:00 GMT 2005


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.

Oddly, there is code to catch a nested do-construct-name,
for example:

   loop: do i = 1, 5
            print *, i
            loop: do j = 1, 5
                     print *, j
                  end do loop
         end do loop

-- 
Steve



More information about the Fortran mailing list