IS INITIAL breaks numeric literals in called subprogram on 2nd call?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Gcc Help]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Info]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux