#58 PROGRAM RETURNING items are not allocated.

GC 2.2
accepted
nobody
None
5 - default
2017-04-22
2014-01-03
Edward Hart
No

The following program causes a segfault when called as the returning item is not allocated and has a NULL address.

PROGRAM-ID. foo.
DATA DIVISION.
LINKAGE SECTION.
01  num                                 PIC 9(5).
PROCEDURE DIVISION RETURNING num.
    MOVE 1 TO num
    .
END PROGRAM foo.

Related

Discussion: RETURNING items of User-Defined FUNCTIONs - WORKING-STORAGE or LINKAGE items?

Discussion

  • Simon Sobisch

    Simon Sobisch - 2014-01-03

    This corresponds to [08d8b633] / [#57]. Do you have any docs that state "RETURNING items should reside in LINKAGE SECTION"? My thought was always that they should be in WORKING STORAGE.
    This works for "normal" programs and will work for user-defined functions (UDF), too, after my patch is applied. If we remove the line 6279 in codegen.c (2.x trunk) it will work for normal programs too, but I'd like to see some docs and discussion before...

    Simon

     

    Related

    Bugs: #57
    Discussion: 08d8b633

  • Edward Hart

    Edward Hart - 2014-01-03

    Do you have any docs that state "RETURNING items should reside in LINKAGE SECTION"?

    From the 2009 Draft COBOL standard (14.2.2.5): '[The RETURNING item] shall be defined as a level 01 entry or level 77 entry in the linkage section'. Furthermore, the Micro Focus docs suggest that the Micro Focus and IBM compilers enforce this (Syntax Rules - 4 and General Rules - 8).

    This corresponds to [08d8b633] / [#57].

    Sorry about the duplicate - it would probably be best if you close this bug report and we carry on any discussion in [#57].

     

    Related

    Bugs: #57
    Discussion: 08d8b633

  • Edward Hart

    Edward Hart - 2017-04-22
    • status: open --> accepted
    • Group: unclassified --> GC 2.2
    • Priority: 1 --> 5 - default
     
  • Edward Hart

    Edward Hart - 2017-04-22

    Still present as of [r1524].

     

    Related

    Commit: [r1524]


Log in to post a comment.

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

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks