#64 CPP-Version: codegen bug for items with "OCCURS 1" clause

GC++ 2.0
closed
None
7
2015-01-06
2014-02-05
No

Bug in CPP only.

The following program results in not compilable C++ source:

       IDENTIFICATION   DIVISION.
       PROGRAM-ID.      prog.
       DATA             DIVISION.
       WORKING-STORAGE  SECTION.
       01  D1.
           03  FILLER   OCCURS 1.
               05 D1-ENTRY   PIC X(03) value '123'.
       01  D2.
           03  D2-ENTRY   PIC X(03)  value 'ABC'  OCCURS 1.
       01  D1TOR.
           03  FILLER   PIC X(03) value '456'.
       01  D1-R         REDEFINES D1TOR.
           03  FILLER   OCCURS 1.
               05 D1-R-ENTRY   PIC X(03).
       01  D2TOR.
           03  FILLER   PIC X(03) value 'DEF'.
       01  D2-R         REDEFINES D2TOR.
           03  D2-R-ENTRY   PIC X(03)   OCCURS 1.

       PROCEDURE        DIVISION.
           IF D1-ENTRY (1) NOT = "123"
              DISPLAY D1-ENTRY (1)
              END-DISPLAY
           END-IF.
           IF D2-ENTRY (1) NOT = "ABC"
              DISPLAY D2-ENTRY (1)
              END-DISPLAY
           END-IF.
           IF D1-R-ENTRY (1) NOT = "456"
              DISPLAY D1-R-ENTRY (1)
              END-DISPLAY
           END-IF.
           IF D2-R-ENTRY (1) NOT = "DEF"
              DISPLAY D2-R-ENTRY (1)
              END-DISPLAY
           END-IF.
           STOP RUN.

See test [OCCURS clause with 1 entry] - see run_misc.at (test added in [r193] and renamed/extended in [r196]):

/tmp/cob20359_0.cpp: In function 'int prog_(int)':
/tmp/cob20359_0.cpp:102: error: no match for 'operator[]' in 'D1.prog_(int)::_s1_D1::FILLER_1[0]'
/tmp/cob20359_0.cpp:107: error: no match for 'operator[]' in 'D1.prog_(int)::_s1_D1::FILLER_1[0]'
/tmp/cob20359_0.cpp:112: error: invalid conversion from 'unsigned char' to 'const void*'
/tmp/cob20359_0.cpp:112: error:   initializing argument 1 of 'int memcmp(const void*, const void*, size_t)'
/tmp/cob20359_0.cpp:117: error: invalid conversion from 'unsigned char' to 'unsigned char*'
/tmp/cob20359_0.cpp:122: error: no match for 'operator[]' in '_un2e1n1.prog_(int)::_s4__un2e1n1::D1_R.prog_(int)::_s4__un2e1n1::_s6_D1_R::FILLER_3[0]'
/tmp/cob20359_0.cpp:127: error: no match for 'operator[]' in '_un2e1n1.prog_(int)::_s4__un2e1n1::D1_R.prog_(int)::_s4__un2e1n1::_s6_D1_R::FILLER_3[0]'
/tmp/cob20359_0.cpp:132: error: invalid conversion from 'unsigned char' to 'const void*'
/tmp/cob20359_0.cpp:132: error:   initializing argument 1 of 'int memcmp(const void*, const void*, size_t)'
/tmp/cob20359_0.cpp:137: error: invalid conversion from 'unsigned char' to 'unsigned char*'
/tmp/cob20359_0.cpp:204: error: no match for 'operator[]' in 'D1.prog_(int)::_s1_D1::FILLER_1[(_i1 - 1)]'
/tmp/cob20359_0.cpp:208: error: invalid conversion from 'unsigned char' to 'void*'
/tmp/cob20359_0.cpp:208: error:   initializing argument 1 of 'void* memcpy(void*, const void*, size_t)'

Simon

Related

Commit: [r193]
Commit: [r196]

Discussion

  • Simon Sobisch

    Simon Sobisch - 2014-02-06

    The bug has to do with OCCURS using only 1 entry, not with REDEFINE.
    I've changed the title and test case (and provided a fix in [r196]).

    Simon

     

    Related

    Commit: [r196]

  • Simon Sobisch

    Simon Sobisch - 2014-11-24
    • Group: unclassified --> GC++ 2.0
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks