Thank you for confirming that it is just a bug with 2.2 and not
something I'm doing incorrectly. Unfortunately, I'm not in a position to
upgrade right now, but I can work around it.
Jay
On 08/21/2018 03:16 PM, Simon Sobisch wrote:
Hi Jay,
the first thing I did was
https://sourceforge.net/p/open-cobol/bugs/search/?q=initial
which leads to
Bug #431 - Decimal constants not initialized in INITIAL programs
https://sourceforge.net/p/open-cobol/bugs/431/
originally reported by Jay Moseley directly after the 2.2 release.
Is this the same case you have?
It sounds like applying the patch
https://sourceforge.net/p/open-cobol/code/2096/#diff-3
will give you a working version with 2.2 (patched).
The original plan was to create a 2.3 one with important fixes but the
team decided to spare the additional work and we start the 3.0 baseline,
with REPORT-WRITER module and SPARSE KEYS support.
While it is not final and there are more things to come for the upcoming
(and hopefully last) release candidate the 3.0 codebase is considered
more stable than 2.2.
I recommend to switch to GnuCOBOL 3.0rc-1, if possible.
https://alpha.gnu.org/gnu/gnucobol/
Note: In any case thank you for the bug report, which also has an impact
on current development - the old testcase for the bug was just extended
with your sample (and passes as all the other INITIAL tests do).
... I really suggest to use 3.0rc-1 over 2.2
Simon
Am 21.08.2018 um 20:19 schrieb Jay Summet:
I'm using gnucobol2.2 and ran into a confusing circumstance that did not
exist when the same code ran in version 1.1.
When calling a subprogram which used "IS INITIAL" like so:
PROGRAM-ID. ProgramName IS INITIAL.
Code inside the program such as:
MULTIPLY PRICE-LOW BY 1.10 GIVING WS-TEMP
Would fail with an "attempt to access unallocated memory" type error.
(But only on the second call to the subprogram, the first worked as
expected).
The issue was the literal 1.10, and not WS-TEMP or PRICE-LOW, which took
a bit of debugging to figure out...
For example
MOVE 1.10 TO WS-TEMP
MULTIPLY PRICE-LOW BY WS-TEMP GIVING WS-TEMP
would work without issue on multiple calls. (Also, if I removed the "IS
INITIAL" from the identification division either set of code worked fine.)
My question:
Is this a known bug (or feature?)
I'm able to work around it using either the inital MOVE or removing the
IS INITIAL, but I'd like to understand why it's happening. (And did NOT
happen with Gnu Cobol 1.1)
Thanks for any insight. If needed I can attempt to provide a simplified
sample program that demonstrates the error, but I was hoping somebody
with more experience already knows the answer....
Jay