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

            Bug ID: 125271
           Summary: Paragraph name resolution not local to SECTION when
                    duplicate paragraph names exist across sections
           Product: gcc
           Version: 16.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: cobol
          Assignee: unassigned at gcc dot gnu.org
          Reporter: peeterjoot at protonmail dot com
  Target Milestone: ---

Created attachment 64432
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64432&action=edit
program with duplicate paragraph names, but referenced only locally within
defining sections

Based on my read of the COBOL 6.4 Language Reference, where it is stated:

(p. 69): "A paragraph-name need not be qualified when referred to within the
section in which it appears."  

It is my interpretation that the attached program should not print:


# gcobol ./para-local-test.cob 
# ./a.out
=== Program starting ===
Inside SECTION-A
   ---> This is PARA-DUPLICATE from SECTION-A
Inside SECTION-B
   ---> This is PARA-DUPLICATE from SECTION-A
=== Program finished ===


but should give:


=== Program starting ===
Inside SECTION-A
   ---> This is PARA-DUPLICATE from SECTION-A
Inside SECTION-B
   ---> This is PARA-DUPLICATE from SECTION-B
=== Program finished ===


i.e.: an unqualified paragraph name is first resolved against the current
section before any global search is attempted.

Reply via email to