To David:

no, there is no MVC. This is the z/OS V1.6 C-Compiler.
I will try and examine the newer versions. Maybe the error is only in this
version. But the description in the language reference also tells that the
remaining components remain uninitialized, which is very strange.

We, too, do this initialization all the time. That's why we feel in trouble now. Most of the time, the areas are explicitly initalized later, anyway, so there is no problem. But in this case, it is not. But still, most of the time, the area is zero, because it has not been used before. So there is still no problem. We observed this problem in the last week
for the first time and it took us several hours to find the reason for it.

To Charles:

The next component is not char, so it makes no sense to simply put
a single hex zero in front of it. The only good reason for the MVI would be
if a overlapped MVC would follow.

Kind regards

Bernd




David Crayford schrieb:
Are you sure there isn't an MVC after the MVI?

I rely on that kind of initialization all the time and have never had a problem. A quick test program shows the correct behavior. If this is not working as the ANSI standard I suggest you open a PMR. To circumvent the problem compile with INITAUTO(0).

* * struct F * { * int a; * char string[20]; * short s; * }; * * struct F f = {0}; LA r0,0 ST r0,f.F.a(,r4,2016) MVI f(r4,2020),0 MVC f(23,r4,2021),f(r4,2020)

Compiled with CHECKOUT compiler option generates the following message.

INFORMATIONAL CCN3447 DOC.C(F1):14 The member(s) starting from "string" will be initialized with a default value of 0.


Bernd Oppolzer wrote:
Sorry for the missing line feeds.

C statement:
*    scp1215ein           in1215     = { 0 };
Pseudo ASSEMBLER (structure starts at 272(r13)):
ST    r6,<a5:d272:l4>(,r13,272)
MVI   <a5:d276:l1>(r13,276),0

C statement:
*    scp1215aus           out1215    = { 0 };
Pseudo ASSEMBLER (structure starts at 296(r13)):
ST    r6,<a5:d296:l4>(,r13,296)
MVI   <a5:d300:l1>(r13,300),0

Kind regards

Bernd


Bernd Oppolzer schrieb:
To make it clear:

see above

The ST operations initialize the first components of the structures,
which are fullwords. This is what should be done, according to
the IBM C language reference.

The rest of the structures should remain unchanged (uninitialized),
according to IBM's language reference, and should be set to zero,
according to ANSI C language reference. The structure out1215,
for example, is 24 bytes long.

Now the MVI makes absolutely no sense to me.

It would only make some sense, if it was followed by an overlapped MVC
instruction, which would set the rest of the structure to zero. But such a
instruction is not generated by the compiler.

???

Kind regards

Bernd




Bernd Oppolzer schrieb:
Hello all,

sorry for asking this question on IBM-Main, but the C370 list is so silent
that I doubt that anyone is actually listening.

We observed a sort of problem today which showed up as a 0C4 abend
due to a not proper initialized pointer component of a C structure.

Further examination showed that the structured was initialized as follows

structure_type  structure_identified = { 0 };

The structure has several components; the last component is the pointer.

According to the IBM C language reference, only the first component is
initialized to zero, and the other components have random contents,
because the storage class is automatic. The compiler generates only
initialization logic for the first few bytes of the auto structure. So from this
point of view, everything is right.

But: the ANSI C language reference, for example in the Kernighan Ritchie book appendix, and most other C language references I found on the web, clearly state that if the number of initializers on structure initialization is less
than the number of structure components, the remaining components are
initialized to zero, even for auto structures.

This is not an error in that sense that the compiler does not what is written in the language reference, but instead it is a contradiction between IBM's
language reference and ANSI language reference.

What do you think about this? Does it make sense to complain at IBM
about it? We have hundreds of C programs in production use which use
this kind of initialization (maybe) and now we are afraid that we need to
examine all these programs.

Kind regards

Bernd


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to