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

--- Comment #3 from Peeter Joot <peeterjoot at protonmail dot com> ---
works for me too: 

ubuntu:/home/peeterjoot/126281> cat *cob
       IDENTIFICATION DIVISION.
       PROGRAM-ID. TYPEDEFLS.
      *----------------------------------------------------------------*
      * Minimal reproducer: a TYPEDEF declared in the LOCAL-STORAGE     *
      * SECTION triggers an internal compiler error at PROCEDURE        *
      * DIVISION.  The COBOL Language Reference explicitly permits      *
      * TYPEDEF in LOCAL-STORAGE (no storage is allocated for a type    *
      * declaration).                                                   *
      *                                                                 *
      * Observed (gcobol 17.0.0 20260710 experimental):                 *
      *   internal compiler error: parser_local_add: parameter          *
      *   'new_var' is variable INT32-T<FldNumericBin5> with NULL       *
      *   'var_decl_node'                                               *
      *                                                                 *
      * Workaround: declare the TYPEDEF in WORKING-STORAGE SECTION      *
      * instead (TYPE instances may still live in LOCAL-STORAGE).       *
      *----------------------------------------------------------------*
       DATA DIVISION.
       LOCAL-STORAGE SECTION.
       01  INT32-T TYPEDEF PIC S9(9) USAGE COMP-5.
       01  LS-N    PIC S9(9) USAGE COMP-5.
       PROCEDURE DIVISION.
           MOVE 1 TO LS-N
           DISPLAY LS-N
           GOBACK.

ubuntu:/home/peeterjoot/126281> /opt/gcc-trunk-20260716/bin/gcobol *cob
-Wl,-rpath,/opt/gcc-trunk-20260716/lib64
ubuntu:/home/peeterjoot/126281> ./a.out
+000000001


Also tested with the original application -- works there now too.

Reply via email to