PR26890 SIZE parameter interacts with same variable in IO list.

Paul Thomas paulthomas2@wanadoo.fr
Tue Mar 28 04:40:00 GMT 2006


Jerry DeLisle wrote:

> I need some input on this one.
>
> The problem here is very easy to fix.  The *dtp-size is set to point 
> to the SIZE parameter set in the READ or WRITE statement.  It is then 
> used to accumulate the number of bytes transferred.  So if that 
> variable also happens to be referenced in the the IO list, it gets 
> clobbered when the I/O is initialized.

This is, of course, why the construct is non-standard (incidentally, 
have you checked my assertion of this?).

>
> The easy fix is to use another integer variable to accumulate the size 
> and then assign it to the SIZE parameter as part of the finalize_transfer.

I just suggested that on Bugzilla.

>
>
> The problem is, to do this I have to add a variable to the dtp 
> structure.  This will effect compatibility with previous versions of 
> the library.

Does it have to be an extra field on the dtp structure? Surely, a static 
variable would do the job, wouldn't it?

>
> Also, I notice that at the end of the dtp structure there is the 
> following:
>
>       char pad[16 * sizeof (char *) + 34 * sizeof (int)];
>
> What is this for?  Can I add an integer and reduce the size of this 
> pad accordingly?  This sure is not documented anywhere.  And I do not 
> see it used anywhere. 

If it is not used, it could be used for temporaries.  It's name imples 
that it is being used for alignment purposes but the space allocated 
belies that.

Paul



More information about the Fortran mailing list