Skip to content

Commit

Permalink
More tests for decimal constant bug patch
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Oct 16, 2023
1 parent 019cc96 commit 142afae
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions tests/testsuite.src/run_misc.at
Original file line number Diff line number Diff line change
Expand Up @@ -14572,14 +14572,14 @@ TST-DECIMAL IS < ZERO-DECIMAL
AT_CLEANUP


AT_SETUP([Decimal constants and INITIAL programs in same source])
AT_KEYWORDS([runmisc])
AT_SETUP([Decimal constants and programs in same source])
AT_KEYWORDS([runmisc INITIAL CANCEL CALL])

# this used to cause a SIGSEGV, see bug #917

AT_DATA([prog.cpy], [
IDENTIFICATION DIVISION.
PROGRAM-ID. :PROG-NAME: INITIAL.
PROGRAM-ID. :PROG-NAME: :PROG-KIND:.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 X PIC 9(2) VALUE 42.
Expand Down Expand Up @@ -14607,16 +14607,26 @@ AT_DATA([prog.cob], [
* ensure that cobc cannot optimize the expression away
IF FUNCTION CURRENT-DATE = 0
ADD 1 TO Y.
CALL "prog2"
CALL "prog3"
CALL "nested_init"
CALL "nonnested_init"
CALL "nested_noninit"
CANCEL "nested_noninit"
CALL "nonnested_noninit"
CANCEL "nonnested_noninit"
IF X + Y + 42.1 <> 0
DISPLAY "OK" WITH NO ADVANCING.
STOP RUN.
COPY prog REPLACING ==:PROG-NAME:== BY ==prog2==.
COPY prog REPLACING ==:PROG-NAME:== BY ==nested_init==
==:PROG-KIND:== BY ==INITIAL==.
COPY prog REPLACING ==:PROG-NAME:== BY ==nested_noninit==
==:PROG-KIND:== BY ====.
END PROGRAM prog.
COPY prog REPLACING ==:PROG-NAME:== BY ==prog3==.
COPY prog REPLACING ==:PROG-NAME:== BY ==nonnested_init==
==:PROG-KIND:== BY ==INITIAL==.
COPY prog REPLACING ==:PROG-NAME:== BY ==nonnested_noninit==
==:PROG-KIND:== BY ====.
])

AT_CHECK([$COMPILE_MODULE prog.cob], [0], [], [])
AT_CHECK([$COBCRUN prog], [0], [OKOKOK], [])
AT_CHECK([$COBCRUN prog], [0], [OKOKOKOKOK], [])
AT_CLEANUP

0 comments on commit 142afae

Please sign in to comment.