Open sergiosa61 opened 8 months ago
Thank you for this nice bug report. If you could additional provide a minimal complete program that shows this behaviour, it would be "easy" for others to check.
Unrelated to this issue but... as noted: try to switch to GnuCOBOL, as the Gix programs were not tested against OpenCOBOL - especially 2, as far as I know (and it is only rarely used world-wide and not supported by .
I would like to know how to provide additional information to determine the cause of the error
The best way is a minimal reproducer. The second best is to ensure you have good debugging information available, for example by passing LDFLAGS=-gdb3 CFLAGS=-ggdb3
to your configure
invocation, then make
/ make install
again, then start gixpp with debugging gdb -ex run --args gixpp $youroptions
and when it stops with the debugger do either core bug178.core
and make a download of this - as well as your installed GixSQL binaries - available (note: this can contain any data that gixpp has read / in its environment, so make sure this is fine) and/or do backtrace
then post its output (with the corefile and the binaries the developers can do it locally and inspect it further).
Hi, i execute gixpp on gdb whith
gdb -ex run --args gixpp --copypath /opt/install/share/gixsql/copy --esql --esql-preprocess-copy --infile MU057R.PCO --outfile MU057R.CBL --debug-info
the optput
Starting program: /opt/install/bin/gixpp --copypath /opt/install/share/gixsql/copy --esql --esql-preprocess-copy --infile MU057R.PCO --outfile MU057R.CBL --debug-info
terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 9) >= this->size() (which is 9)
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../sysdeps/unix/sysv/linux/raise.c: File o directory non esistente.
(gdb) backtrace
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff7ac1535 in __GI_abort () at abort.c:79
#2 0x00007ffff7e88983 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#3 0x00007ffff7e8e8c6 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x00007ffff7e8e901 in std::terminate() () from /lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x00007ffff7e8eb34 in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
#6 0x00007ffff7e8a891 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#7 0x000000000042dddc in std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_range_check (__n=<optimized out>, this=0x4dffa0) at /usr/include/c++/8/bits/basic_string.h:936
#8 std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::at (__n=<optimized out>, this=0x4dffa0) at /usr/include/c++/8/bits/stl_vector.h:981
#9 TPESQLProcessor::put_cursor_declarations (this=0x4dfd80) at TPESQLProcessor.cpp:558
#10 0x0000000000437723 in TPESQLProcessor::outputESQL (this=0x4dfd80) at TPESQLProcessor.cpp:228
#11 0x00000000004381aa in TPESQLProcessor::run (this=0x4dfd80, prev_step=...) at TPESQLProcessor.cpp:159
#12 0x0000000000423134 in GixPreProcessor::transform (this=0x7fffffffd4b0) at /usr/include/c++/8/ext/atomicity.h:96
#13 0x00000000004241fc in GixPreProcessor::process (this=this@entry=0x7fffffffd4b0) at GixPreProcessor.cpp:146
#14 0x000000000041123d in main (argc=<optimized out>, argv=<optimized out>) at main.cpp:217
The source is quite big, 29073 code rows.
Tell me what I can add to help the error analysis
Thank you
Hi, I have generated a cobol source that generates the return code 262. I have reduced the original program. I also attach the source and the core.
By removing the comments on lines 4828 to 4833, the return code does not occur. In this case gixpp generates a source with errors: the calls to the library routines use references to non-generated variables.
EPAST003.CBL: In paragraph 'APRE-FL':
EPAST003.CBL: 4965: Error: 'SQ0013' is not defined
GIXSQL 01 SQ0001.
GIXSQL 02 FILLER PIC X(0363) VALUE "SELECT SUBSTR(K_TBG , 4 , 2) "
GIXSQL & ", TRIM(SUBSTR(FLDTBG , 1 , 35)) , TRIM(SUBSTR(FLDTBG , 117 "
GIXSQL & ", 6)) , TRIM(SUBSTR(FLDTBG , 177 , 2)) , TRIM(SUBSTR(FLDTBG"
GIXSQL & " , 240 , 2)) , TRIM(SUBSTR(FLDTBG , 242 , 4)) , TRIM(SUBSTR"
GIXSQL & "(FLDTBG , 234 , 2)) , TRIM(SUBSTR(FLDTBG , 202 , 2)) , TRIM"
GIXSQL & "(SUBSTR(FLDTBG , 221 , 2)) , TRIM(SUBSTR(FLDTBG , 236 , 2))"
GIXSQL & " FROM PARSTAB WHERE K_TBG LIKE 'T01__%'".
GIXSQL 02 FILLER PIC X(1) VALUE X"00".
GIXSQL 01 SQ0002.
GIXSQL 02 FILLER PIC X(0103) VALUE "SELECT K_NDG , K_PRATICA , ND"
GIXSQL & "GPROMOT , NDGASSOC , NDGGESTORE , NDGSEGNAL FROM PRATICHE W"
GIXSQL & "HERE K_ABI = $1".
GIXSQL 02 FILLER PIC X(1) VALUE X"00".
GIXSQL 01 SQ0003.
GIXSQL 02 FILLER PIC X(0106) VALUE "SELECT K_NDG , NEWNFIDO , DES"
GIXSQL & "TINAZIONE , IMPORTO , AUTOPRAPP FROM FIDI WHERE K_ABI = $1 "
GIXSQL & "AND TPRECORD = 'C'".
GIXSQL 02 FILLER PIC X(1) VALUE X"00".
GIXSQL 01 SQ0004.
GIXSQL 02 FILLER PIC X(0289) VALUE "SELECT K_CHIAVE , K_TIPO_INFO"
GIXSQL & " , DESCR , DATAINIVAL , DATAFINVAL , VALORE , DATA , TESTO "
GIXSQL & ", DATAINS , USERINS FROM ANXDATIVARI WHERE K_ABI = $1 AND K"
GIXSQL & "_TIPO_INFO IN('IMPOREVOCATO' , 'FD-TIPOPROVV' , 'FD-DTDELPR"
GIXSQL & "RV' , 'FD-CONTRFATT' , 'FD-AUTEROFD' , 'COR/CUP03' , 'COR/V"
GIXSQL & "AR03' , 'MCC-POSCHIUSE')".
GIXSQL 02 FILLER PIC X(1) VALUE X"00".
GIXSQL 01 SQ0005.
GIXSQL 02 FILLER PIC X(0186) VALUE "SELECT K_CHIAVE , K_TIPO_INFO"
GIXSQL & " , DOMINIO , TESTO , DESCR FROM ANXDATIVARI WHERE K_ABI = $"
GIXSQL & "1 AND K_TIPO_INFO IN('TIPOIPA03' , 'TIPOIPB03' , 'TIPOIPC03"
GIXSQL & "' , 'FASCIACLASSE03') ORDER BY K_CHIAVE".
GIXSQL 02 FILLER PIC X(1) VALUE X"00".
GIXSQL 01 SQ0006.
GIXSQL 02 FILLER PIC X(0189) VALUE "SELECT K_CHIAVE , K_TIPO_INFO"
GIXSQL & " , DOMINIO , TESTO FROM ANXDATIVARI WHERE K_ABI = $1 AND K_"
GIXSQL & "TIPO_INFO IN('GIUDIZIOIPA03' , 'GIUDIZIOIPB03' , 'GIUDIZIOI"
GIXSQL & "PC03' , 'GIUDIZIOIPD03') ORDER BY K_CHIAVE".
GIXSQL 02 FILLER PIC X(1) VALUE X"00".
GIXSQL 01 SQ0007.
GIXSQL 02 FILLER PIC X(0104) VALUE "SELECT K_NDG , DATA_SOTTOSCRI"
GIXSQL & "ZIONE , DATAVAL , TIPO_CONSENSO FROM PRYTES WHERE K_ABI = $"
GIXSQL & "1 ORDER BY K_NDG".
GIXSQL 02 FILLER PIC X(1) VALUE X"00".
GIXSQL 01 SQ0008.
GIXSQL 02 FILLER PIC X(0497) VALUE "SELECT max(NVL(DATACR , '0000"
GIXSQL & "0000')) AS DATARIF , CR , K_NDG FROM (SELECT MAX(NVL(DRIF ,"
GIXSQL & " '000000000')) AS DATACR , CR FROM IMPRIT GROUP BY CR UNION"
GIXSQL & " MAX(DRIF) AS DATACR , CR FROM CRTBIMPO WHERE (TIMBRO , CR"
GIXSQL & ") IN (SELECT TIMBRO , CR FROM CRTBCOMM WHERE COMUNICAZIONE "
GIXSQL & "IN ('107' , '108') AND (DATA_PRODUZIONE , CR) IN (SELECT MA"
GIXSQL & "X(DATA_PRODUZIONE) AS DATA , CR FROM CRTBCOMM WHERE COMUNIC"
GIXSQL & "AZIONE IN ('107' , '108') GROUP BY CR))GROUP BY CR) LEFT JO"
GIXSQL & "IN DBANA ON CR = NU_CENTRALE_RISCHI GROUP BY CR , K_NDG".
GIXSQL 02 FILLER PIC X(1) VALUE X"00".
GIXSQL 01 SQ0009.
GIXSQL 02 FILLER PIC X(0065) VALUE "SELECT K_NDG , K_DATA , K_DAT"
GIXSQL & "AVAL FROM RTGCERVED WHERE K_ABI = $1".
GIXSQL 02 FILLER PIC X(1) VALUE X"00".
GIXSQL 01 SQ0010.
GIXSQL 02 FILLER PIC X(0136) VALUE "SELECT K_ABI , K_CHIAVE , K_T"
GIXSQL & "IPO_INFO , DOMINIO , DESCR FROM ANXDATIVARI WHERE K_ABI = $"
GIXSQL & "1 AND K_TIPO_INFO = 'LEGALE03' ORDER BY K_CHIAVE".
GIXSQL 02 FILLER PIC X(1) VALUE X"00".
GIXSQL 01 SQ0011.
GIXSQL 02 FILLER PIC X(0017) VALUE "START TRANSACTION".
GIXSQL 02 FILLER PIC X(1) VALUE X"00".
GIXSQL 01 SQ0012.
GIXSQL 02 FILLER PIC X(0018) VALUE "SELECT 1 FROM DUAL".
GIXSQL 02 FILLER PIC X(1) VALUE X"00".
GIXSQL CALL "GIXSQLExecSelectIntoOne" USING
GIXSQL BY REFERENCE SQLCA
GIXSQL BY REFERENCE x"00"
GIXSQL BY VALUE 0
GIXSQL BY REFERENCE SQ0013
GIXSQL BY VALUE 0
GIXSQL BY VALUE 1
GIXSQL END-CALL
GIXSQL CALL "GIXSQLEndSQL"
GIXSQL END-CALL
004835 MOVE SQLCODE TO SQL-CODE
It seems that after a while the pointing to the SQnnnn variables is moved forward one or two positions
In the case below the call uses SQ0012 instead of SQ0011
GIXSQL* EXEC SQL
GIXSQL* START TRANSACTION
GIXSQL* END-EXEC
GIXSQL CALL "GIXSQLStartSQL"
GIXSQL END-CALL
GIXSQL CALL "GIXSQLExec" USING
GIXSQL BY REFERENCE SQLCA
GIXSQL BY REFERENCE x"00"
GIXSQL BY VALUE 0
GIXSQL BY REFERENCE SQ0012
GIXSQL END-CALL
GIXSQL CALL "GIXSQLEndSQL"
GIXSQL END-CALL
I looked closely at my program to identify the cause of the bug but found nothing.
That's all for now Thank you
Hi, I generated two simple cobol sources to reproduce the error: TSQL178A.cbl and TSQL178B.cbl. The cause of the error appears to be the insertion of sub select inside the cursor (TSQL178A.cbl). The second TSQL178B.cbl does not have sub selects and works. The two programs are identical and should produce the same result. the first generates the error "terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 3) >= this->size() (which is 2)" and contains some sub select in the query. The second program does not generate any errors with gixpp and compiles correctly Bug178_source.zip
In trying to process same cobol programs for our Oracle migration project, I get the following errors.
I am unable to determine the program lines that generate the errors.
I would like to know how to provide additional information to determine the cause of the error
The first program
The second
The gixpp version
The cobc version
Os Version