bug-gnucobol
[Top][All Lists]
Advanced

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

Re: [Bug-GnuCOBOL] produces uncompilable c code


From: Simon Sobisch
Subject: Re: [Bug-GnuCOBOL] produces uncompilable c code
Date: Sat, 1 Apr 2017 17:53:19 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

folkert wrote:
> That's not what all the other compilers do.
> At least MF and maybe also enterprise cobol accepts it.
>
>
> On Fri, Mar 31, 2017 at 11:51:37AM +0100, Edward Hart wrote:
>> This bug has been fixed in r1486: SET ADDRESS OF BYTES(1) now causes an
>> error like other compilers.
> Folkert van Heusden
>

The fix Edward put in is perfectly fine.
We don't have support everything other compilers support, especially if
it is a not needed extension. If you change the code to use `SET ADDRESS
OF GROUP` instead of `SET ADDRESS OF BYTES(1)` the code will compile
with all compilers that support `SET ADDRESS OF` (including the old
environment) and the code itself is much more clearer.

Additional `SET ADDRESS OF` is not that often used... If this is
different with your code you're free to use a modified GnuCOBOL version
(people actually do this in production) that only raises the syntax
error if the offset from the parent item is not 0.

Nonetheless: Thank you for reporting this bug - even if the fix is not
what you may want to have: generating C sources that break the C
compilation process is seen as an important bug. And with the clean
syntax error we raise now the COBOL programmer knows what he can do to
fix it.


... and as reported before: most other compilers do *not* allow this:


Mainframe:

ska 403> cob2 ptr2.cbl
 PP 5655-S71 IBM Enterprise COBOL for z/OS  4.2.0 in progress ...

19 IGYPS2161-S "ADDRESS OF" operand "BYTES" was found as the receiving
operand of a "SET" statement, but was not a level-01 or level-77
"LINKAGE SECTION" item.  The statement was discarded.


Micro Focus Net Express V3:

Version 3.1.11 Copyright (C) 1984-2000 MERANT International Ltd.
URN AXCGG/AA0/00000
    19     SET ADDRESS OF BYTES(1) TO MEM-ADDR.
* 344-S*************************** **
**    Should be level 01 or 77
* Checking complete - errors found


ACUCOBOL-GT:

TESTMOVE.cbl, line 14: Must be level 01 or 77: BYTES




reply via email to

[Prev in Thread] Current Thread [Next in Thread]