[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[open-cobol-list] Alignment rule (Re: Latest CVS causes compile failures
From: |
Keisuke Nishida |
Subject: |
[open-cobol-list] Alignment rule (Re: Latest CVS causes compile failures) |
Date: |
Thu Mar 4 06:42:12 2004 |
User-agent: |
Wanderlust/2.10.0 (Venus) SEMI/1.14.3 (Ushinoya) FLIM/1.14.3 (UnebigoryĆmae) APEL/10.3 Emacs/21.2 (i386-redhat-linux-gnu) MULE/5.0 (SAKAKI) |
At Sun, 29 Feb 2004 17:31:24 +0100,
Margit Schubert-While wrote:
>
> Compile failures caused by trying to align items.
> This is immediately apparent with redefines.
> This is WRONG.
> eg.
> 01 Blah.
> 03 f1 pic x.
> 03 f2 pic s9(4) comp.
> 03 f3 pic s9(4) comp-5.
> 03 f4 pic s9(3) comp-3.
> 03 f5 usage comp-2.
> 03 f6 usage index.
> 03 f7 usage pointer.
>
> Assuming comp-2 to be implemented this gives :
> 1 + 2 + 2 + 2 + 8 + 4 + 4 (arguably 8 on a 64 bit implementation)
> This gives 23 bytes. No more, no less.
> The compiler may NOT change allocation/alignment UNLESS
> advised to do so by the SYNCHRONIZED statement and then
> ONLY for certain "-std=" options. (With MF, only in combination
> with the IBMCOMP option, which equates to std=mvs, otherwise
> ignored)
Right. I'll fix the compiler so as not to change the alignment
of data items in a group. On the other hand, the compiler may
(or should) change the alignment of 01 items, right?
For example, given the following data definition,
01 PTR USAGE POINTER.
the address of PTR should be aligned on some architectures;
otherwise, the program core dumps when the pointer is dereferenced.
Now I have a question. Given the following definition,
01 GRP.
...
03 PTR USAGE POINTER.
...
should I align GRP or not? Since the start address of PTR is
dependent on other data items in the group, changing the
alignment of GRP is meaningless.
As a result, we need to take care of alignment only
1. if 01 item is of usage index or any pointer
or
2. if 01 item is a group and any data item that is subordinate
to the group has a SYNCHRONIZED clause.
Right?
Keisuke
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [open-cobol-list] Alignment rule (Re: Latest CVS causes compile failures),
Keisuke Nishida <=