[PATCH, libgfortran] Remove generate_error from mem_alloc_w_at and clean up

Janne Blomqvist jblomqvi@cc.hut.fi
Fri Oct 7 08:23:00 GMT 2005


On Thu, Oct 06, 2005 at 11:48:42PM -0700, Jerry DeLisle wrote:
> :ADDPATCH fortran:
> 
> The attached patch moves the generate_error call into write_block to clear 
> the way for thread safe patch.  The patch also adds checks for NULL returns 
> from write_block calls where these were missing to avoid possible memory 
> writes to NULL pointer.
> 
> Regression tested on i686-pc-linux-gnu. OK for mainline in front of Jacub's 
> patch?  Or Jacub incorporate this?
> 
> Regards Jerry
> 
> 2005-10-07  Jerry DeLisle  <jvdelisle@verizon.net>
> 
>         * io/transfer.c (write_block): Add test for end-of-file condition,
>         removed from mem_alloc_w_at.
>         * io/trasnfer.c (unformatted_write): Add return on NULL from
                  1

Typo at (1). Also, you don't need to change unformatted_write() at
all, since your patch doesn't actually change the behaviour of the
function. The original

if (p != NULL)
    memcpy (...)
} /* end of function.  */

is equivalent with your

if (p == NULL)
    return;
memcpy (...)
} /* end of function.  */

Finally, the file name shouldn't be mentioned multiple times in the
changelog. Just start a new sentence with "(function_name):".

Otherwise the patch looks ok. I haven't tested it though.

-- 
Janne Blomqvist



More information about the Gcc-patches mailing list