diff --git a/gcc/cobol/UAT/testsuite.src/run_misc.at b/gcc/cobol/UAT/testsuite.src/run_misc.at index b7c27567e42528728e6a4edf1a516e6fb8b03aa2..861d714744e950ce7b527fc0bfcad996e895b40b 100644 --- a/gcc/cobol/UAT/testsuite.src/run_misc.at +++ b/gcc/cobol/UAT/testsuite.src/run_misc.at @@ -3337,3 +3337,87 @@ AT_CHECK([$COMPILE -c callee2.cob], [0], [], []) AT_CHECK([$COMPILE -o prog caller.cob callee.o callee2.o], [0], [], []) AT_CHECK([./prog], [0], [abc000], []) AT_CLEANUP + +AT_SETUP([LOCAL-STORAGE (3) with recursive PROGRAM-ID]) +AT_KEYWORDS([misc]) +AT_DATA([prog.cob], [ + IDENTIFICATION DIVISION. + PROGRAM-ID. caller. + PROCEDURE DIVISION. + CALL "callee" + END-CALL. + STOP RUN. + end program caller. + + IDENTIFICATION DIVISION. + PROGRAM-ID. callee. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 WRK-X PIC 999 VALUE 5. + LOCAL-STORAGE SECTION. + 01 LCL-X PIC 999 . + PROCEDURE DIVISION. + display "On entry: " wrk-x + move wrk-x to lcl-x + subtract 1 from wrk-x + if wrk-x > 0 + call "callee". + display "On exit: " lcl-x + goback. + end program callee. +]) +AT_CHECK([$COMPILE -o prog prog.cob], [0], [], []) +AT_CHECK([./prog], [0], [On entry: 005 +On entry: 004 +On entry: 003 +On entry: 002 +On entry: 001 +On exit: 001 +On exit: 002 +On exit: 003 +On exit: 004 +On exit: 005 +], []) +AT_CLEANUP + +AT_SETUP([LOCAL-STORAGE (4) with recursive PROGRAM-ID ... USING]) +AT_KEYWORDS([misc]) +AT_DATA([prog.cob], [ + IDENTIFICATION DIVISION. + PROGRAM-ID. caller. + PROCEDURE DIVISION. + CALL "callee" + END-CALL. + STOP RUN. + end program caller. + + IDENTIFICATION DIVISION. + PROGRAM-ID. callee. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 WRK-X PIC 999 VALUE 5. + LOCAL-STORAGE SECTION. + 01 LCL-X PIC 999 . + PROCEDURE DIVISION. + display "On entry: " wrk-x + move wrk-x to lcl-x + subtract 1 from wrk-x + if wrk-x > 0 + call "callee". + display "On exit: " lcl-x + goback. + end program callee. +]) +AT_CHECK([$COMPILE -o prog prog.cob], [0], [], []) +AT_CHECK([./prog], [0], [On entry: 005 +On entry: 004 +On entry: 003 +On entry: 002 +On entry: 001 +On exit: 001 +On exit: 002 +On exit: 003 +On exit: 004 +On exit: 005 +], []) +AT_CLEANUP diff --git a/gcc/cobol/genapi.cc b/gcc/cobol/genapi.cc index 3fda2f820f97c8a8e66e416c3526d696d5a4435a..9a856652c5ef514882751387fb43a290ccc03dc3 100644 --- a/gcc/cobol/genapi.cc +++ b/gcc/cobol/genapi.cc @@ -14340,7 +14340,7 @@ parser_local_add(struct cbl_field_t *new_var ) // We need to allocate memory on the stack for this variable char achDataName[256]; sprintf(achDataName, "..vardata_%lu", sv_data_name_counter++); - fprintf(stderr, "compile-time local name is %s\n", achDataName); + //fprintf(stderr, "compile-time local name is %s\n", achDataName); tree array_type = build_array_type_nelts(UCHAR, new_var->data.capacity); tree data_decl_node = gg_define_variable( array_type, @@ -14348,7 +14348,7 @@ parser_local_add(struct cbl_field_t *new_var ) vs_stack); gg_assign( member(new_var->var_decl_node, "data"), gg_get_address_of(data_decl_node) ); - gg_printf("run-time local name is %s %p\n", gg_string_literal(achDataName), gg_get_address_of(data_decl_node), NULL_TREE); + //gg_printf("run-time local name is %s %p\n", gg_string_literal(achDataName), gg_get_address_of(data_decl_node), NULL_TREE); } cbl_refer_t wrapper; wrapper.field = new_var;