Menu

Different result by version

M_D
2021-09-14
2021-10-07
  • M_D

    M_D - 2021-09-14

    Hi everyone,

    I am work on Centos 8.

    Why on the same code file the compilation is done on 4.0 but compilation is stop on previous versions?
    I have the same output on version 3.0-rc , 3.1.2, 3.2-dev.0 but it's only on the version 4.0-early-dev.0, why i have a different result?

    **Version 3.0-rc**
    
    [matigoal]$ bash compil-MDGFK10.sh 
    COMPILATION DE > ./MDGFK10.cob
    In file included from /tmp/cob14930_0.c:24:
    /tmp/cob14930_0.c. h:172:44: error: undeclared a_22 here (out of function); did you want to use a_21?
     static cob_field f_392 = {1, b_350 + 634, &a_22}; /* INDEX */
                                                ^~~~
                                                a_21
    
    **Version 3.1.2**
    [matigoal]$ bash compil-MDGFK10.sh 
    COMPILATION OF > . /MDGFK10.cob
    In file included from /tmp/cob18713_0.c:21:
    /tmp/cob18713_0.c. h:172:44: error: undeclared a_22 here (out of function); did you want to use a_21?
    static cob_field f_394 = {1, b_352 + 634, &a_22}; /* INDEX */
    ^~~~
    a_21
    
    **Version 3.2-dev.0**
    
    [matigoal]$ bash compil-MDGFK10.sh 
    COMPILATION OF > . /MDGFK10.cob
    In file included from /tmp/cob14950_0.c:21:
    /tmp/cob14950_0.c. h:172:44: error: undeclared a_22 here (out of function); did you want to use a_21?
    static cob_field f_394 = {1, b_352 + 634, &a_22}; /* INDEX */
    ^~~~
    a_21
    
        `**Version 4.0-early-dev.0**`
    
    [ matigoal]$ bash compil-MDGFK10.sh 
    COMPILATION DE > ./MDGFK10.cob
    

    Thanks for your help.

     

    Last edit: M_D 2021-09-14
  • Simon Sobisch

    Simon Sobisch - 2021-09-14

    Looks like a bug which is fixed in 4.0.
    If you can send a minimal reproducer we likely can merge the fix over to 3.x...

     
    • M_D

      M_D - 2021-09-14

      @sf-mensch
      thank for your reply.

      It's a undeclared variable but if it's undeclared on version 3.x normally she's always undeclared in version 4.0?

       

      Last edit: M_D 2021-09-14
      • Simon Sobisch

        Simon Sobisch - 2021-09-14

        That's an error from the used "C" compiler - if you don't do special C-inclusions and/or special linking this is normally always a "codegen bug" of cobc, which seems to be "finally fixed" in 4.x.

        But I don't know and neither can fix it for 3.x or merge a fix from 4.x, because I have no clue where this happens and why. Posting a COBOL source "reproducer" (just kick as much code out as you can keeping it compile with 4.x and not compile with 3.x) would allow people reading along to actually check what the bug is and how to solve it.

         
  • M_D

    M_D - 2021-10-05

    Hi Simon,
    @sf-mensch
    Sorry for the wait here the reproduction of the bug as requested in attachment.

    Thank for your help.

     

    Last edit: M_D 2021-10-05
  • M_D

    M_D - 2021-10-05

    @sf-mensch

    I tested my script with the versions

    3.0RC : it compiles
    3.1.2 : I have an infinite loop
    3.2 : I have an infinite loop
    4.0 nightly : it compiles

    I don't understand why some versions work and not the others

    Thank for your help.

     

    Last edit: M_D 2021-10-05
    • Simon Sobisch

      Simon Sobisch - 2021-10-05

      I don't understand why some versions work and not the others

      Because 4.x was split from 3 (where it worked) before 3.1 (where a change was made that will be included in 4.x later).

      Sorry for the wait here the reproduction of the bug as requested in attachment.

      That's ok, I'll check that and likely fix the issue in until tomorrow for 3.2.

       
  • M_D

    M_D - 2021-10-05

    Hi Simon,
    @sf-mensch

    thank you so much for your help

     
  • M_D

    M_D - 2021-10-07

    Hello Simon,
    Just to know if you have a better idea what's going on,
    that interest me to understant why this code didn't compile on 3.1.2 and 3.2.
    Is that a syntax problème as saying IBM cob2 or is that a problème in cobc ?
    Thank you !

     
    • Simon Sobisch

      Simon Sobisch - 2021-10-07

      The C codegen part is definitely a problem in cobc - and after finishing the tests for the current parser adjustments and checking those in it is the next issue I'll look at.

      It additional is potentially a syntax issue, in this case cobc will output a warning (or, if it is really bad, output a clear error message).

       
  • M_D

    M_D - 2021-10-07

    Ok thank you,
    waiting for the feed back

     

Anonymous
Anonymous

Add attachments
Cancel