Menu

#1194 Internal Compiler Error on ENTRY statement with invalid USING

GC 3.x
accepted
5 - default
2026-02-09
2026-02-09
No

Following program cause an internal compiler error.

       >>SOURCE FORMAT IS FREE
ID DIVISION.
program-id. TESTENTRY.
DATA DIVISION.
LINKAGE SECTION.
01  wFIELD01-L PIC XX value NULL.

PROCEDURE DIVISION.
*> ENTRY 'aaaa' USING wFIELD01-L.

ENTRY 'myENTRY01' USING 'xxxxxxxxxx'.

*> FOLLOWING STATEMENTS CAUSE SAME INTERNAL COMPILER ERROR
*> ENTRY 'myENTRY01' USING omitted .
*> ENTRY 'myENTRY01' USING by CONTENT    'jjjj' .
*> ENTRY 'myENTRY01' USING by REFERENCE  'jjjj' .
*> ENTRY 'myENTRY01' USING by REFERENCE wFIELD01-L 'aaaaa' omitted.
GOBACK.

Messages from SuperBOL:

 *  Executing task: cobc -x -ftraceall -g -fformat=auto -std=default -ext cpy -ext cbl -ext cob TESTNULL.COB -I . 

cobc: call to 'cb_ref' with invalid parameter 'x'
cobc: tree.c:5152: internal compiler error

cobc: aborting compile of TESTENTRY.COB at line 11 (PROGRAM-ID: TESTENTRY)

cobc: Please report this!


 *  The terminal process "C:\WINDOWS\System32\cmd.exe /d /c cobc -x -ftraceall -g -fformat=auto -std=default -ext cpy -ext cbl -ext cob TESTNULL.COB -I ." terminated with exit code: 3. 
 *  Terminal will be reused by tasks, press any key to close it. 

Related

Bugs: #1194

Discussion

  • Simon Sobisch

    Simon Sobisch - 2026-02-09
    • labels: --> cobc, internal compiler error, ENTRY, literals
    • summary: Internal Compiler Error on ENTRY statement --> Internal Compiler Error on ENTRY statement with invalid USING
    • status: open --> accepted
    • assigned_to: Simon Sobisch
    • Group: GC 3.2 --> GC 3.x
     
  • Simon Sobisch

    Simon Sobisch - 2026-02-09

    As likely kown that is "ice-invalid" (internal compiler error on invalid code).
    cobc should error when using anything but data-items for the USING clause.

    Interestingly gcobol has the exact same issue :-) I'll fill a bug report for that as well.

     
  • Eugenio Di Lorenzo

    The updated PG and the old Grammar documentation currently contain what I'm attaching.
    As far as I can see, ENTRY is a verb that does not exist in the ISO STANDARD:
    Could you give me the correct syntax version ?

     
    • Simon Sobisch

      Simon Sobisch - 2026-02-09

      The USING clause needs to be adjusted - only BY REFERENCE (default) or BY VALUE, only identifier (with identifier being a level 01/77 data-item in LINKAGE SECTION).

      The rest is fine (but the call-convention/linkage part being dialect specific).

       

      Last edit: Simon Sobisch 2026-02-09
      • Eugenio Di Lorenzo

        Then it should be as follows.
        Can you confirm this ?

        ENTRY [ { STATIC          } ] [ WITH { STDCALL } LINKAGE ] literal-1   
        ~~~~~   { ~~~~~~          }     ~~~~ { ~~~~~~~ } ~~~~~~~   
                { STDCALL         }          { C       }          
                { ~~~~~~~         }          { ~       }          
                { C               }          { PASCAL  }          
                { ~               }           ~~~~~~            
                { PASCAL          }  
                { ~~~~~~          }  
                { EXTERN          }  
                { ~~~~~~          }  
                { mnemonic-name-1 }  
        
              [ USING  { [ BY { REFERENCE } ] { identifier-1 }... }... ] 
                ~~~~~         { ~~~~~~~~~ }         
                              { VALUE     }    
                                ~~~~~              
        
         

        Last edit: Eugenio Di Lorenzo 2026-02-09
      • Eugenio Di Lorenzo

        You said that ENTRYonly allows BY REFERENCEand BY VALUE but bollowing sample use ENTRY ... USING BY CONTENT .... and it compiles without errors.
        How come ?

               >>SOURCE FORMAT IS FREE
        ID DIVISION.
        program-id. TESTENTRY.
        DATA DIVISION.
        working-storage section.
        01 wFIELD01 PIC XXX. 
        01 wFIELD02 PIC 999 value 2. 
        LINKAGE SECTION.
        01  wFIELD01-L PIC XX value NULL.
        PROCEDURE DIVISION.
            ENTRY 'MYPROG1' USING  BY CONTENT                 wFIELD01-L.
        *>  ENTRY 'MYPROG2' USING  BY VALUE   UNSIGNED SIZE 2 wFIELD01-L.
        *>  ENTRY 'MYPROG3' USING  BY VALUE   SIZE DEFAULT    wFIELD01-L.
        *>  ENTRY 'MYPROG4' USING  BY VALUE   SIZE AUTO       wFIELD01-L.
        GOBACK.
        
         
        • Simon Sobisch

          Simon Sobisch - 2026-02-09

          That's a bug in the code - only the caller may define BY CONTENT (while the callee would use BY REFERENCE as a counter-side).

          This is all in the same area of the code and will be fixed together.

          I can confirm that the syntax diagram is the one you've posted above (with WITH ... LINKAGE being dialect specific and only be usable when the internal or standard-compliant manually defined call-convention mnemonic-name is not used),

           
    • Vincent (Bryan) Coen

      ENTRY entry-name [USING identifier-1 [identifier-2].....]  - (VSC2)
      (OSV2) (MF)

      ENTRY entry-name         (MF)

      [ USING { BY REFERENCE ] data-name-1 ....  }... ]
      [             { BY VALUE ] data-name-2 ....  (MF)  }... ] (MF) (OPSVS)
      (VSC2)

      Taken from MF COBOL for DOS, Windows, and OS/2 pocket guide issue 6
      April 1993
               The Workbench system and yes I do have the full manual/s
      here.  indecupboard.

      On 09/02/2026 15:07, Eugenio Di Lorenzo wrote:

      The updated PG and the old Grammar documentation currently contain
      what I'm attaching.
      As far as I can see, ENTRY is a verb that does not exist in the ISO
      STANDARD:
      Could you give me the correct syntax version ?

      Attachments:


      [bugs:#1194] https://sourceforge.net/p/gnucobol/bugs/1194/ Internal
      Compiler Error on ENTRY statement with invalid USING

      Status: accepted
      Group: GC 3.x
      Labels: cobc internal compiler error ENTRY literals
      Created: Mon Feb 09, 2026 12:00 PM UTC by Eugenio Di Lorenzo
      Last Updated: Mon Feb 09, 2026 02:38 PM UTC
      Owner: Simon Sobisch

      Following program cause an internal compiler error.

      |>>SOURCEFORMATISFREE IDDIVISION. program-id.TESTENTRY. DATADIVISION.
      LINKAGESECTION. 01wFIELD01-LPICXXvalueNULL. PROCEDUREDIVISION.
      >ENTRY'aaaa'USINGwFIELD01-L. ENTRY'myENTRY01'USING'xxxxxxxxxx'.
      >FOLLOWINGSTATEMENTSCAUSESAMEINTERNALCOMPILERERROR
      >ENTRY'myENTRY01'USINGomitted.
      >ENTRY'myENTRY01'USINGbyCONTENT'jjjj'.
      >ENTRY'myENTRY01'USINGbyREFERENCE'jjjj'.
      >ENTRY'myENTRY01'USINGbyREFERENCEwFIELD01-L'aaaaa'omitted. GOBACK. |

      Messages from SuperBOL:

      |* Executing task: cobc -x -ftraceall -g -fformat=auto -std=default
      -ext cpy -ext cbl -ext cob TESTNULL.COB -I . cobc: call to 'cb_ref'
      with invalid parameter 'x' cobc: tree.c:5152: internal compiler error
      cobc: aborting compile of TESTENTRY.COB at line 11 (PROGRAM-ID:
      TESTENTRY) cobc: Please report this! * The terminal process
      "C:\WINDOWS\System32\cmd.exe /d /c cobc -x -ftraceall -g -fformat=auto
      -std=default -ext cpy -ext cbl -ext cob TESTNULL.COB -I ." terminated
      with exit code: 3. * Terminal will be reused by tasks, press any key
      to close it. |


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/gnucobol/bugs/1194/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #1194


Log in to post a comment.

MongoDB Logo MongoDB