Hi! On Tue, 06 Jan 2009 00:10:02 +0200, Janne Blomqvist <blomqvist.ja...@gmail.com> wrote: > attached is a substantially reworked low level I/O library for gfortran. > [...]
Due to a recent improvement in GCC, it is now pointing out an issue in the following code: > 2009-01-05 Janne Blomqvist <j...@gcc.gnu.org> > > PR libfortran/25561 libfortran/37754 > * [...] > --- a/libgfortran/io/transfer.c > +++ b/libgfortran/io/transfer.c > [...] > if ((dtp->common.flags & IOPARM_DT_HAS_SIZE) != 0) > - dtp->u.p.size_used += (GFC_IO_INT) nread; > + dtp->u.p.size_used += (GFC_IO_INT) *nbytes; > > - if (nread != *nbytes) > - { /* Short read, this shouldn't happen. */ > - if (likely (dtp->u.p.current_unit->pad_status == PAD_YES)) > - *nbytes = nread; > - else > + if (norig != *nbytes) > + { > + /* Short read, this shouldn't happen. */ > + if (!dtp->u.p.current_unit->pad_status == PAD_YES) > { > generate_error (&dtp->common, LIBERROR_EOR, NULL); > source = NULL; > } > } > > - dtp->u.p.current_unit->strm_pos += (gfc_offset) nread; > + dtp->u.p.current_unit->strm_pos += (gfc_offset) *nbytes; > [...] ../../../source/libgfortran/io/transfer.c: In function 'read_block_form': ../../../source/libgfortran/io/transfer.c:478:46: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses] if (!dtp->u.p.current_unit->pad_status == PAD_YES) ^ I assume the following is what is intended, but I have not made an attempt to verify this: diff --git libgfortran/io/transfer.c libgfortran/io/transfer.c index af2932c..710de7a 100644 --- libgfortran/io/transfer.c +++ libgfortran/io/transfer.c @@ -475,7 +475,7 @@ read_block_form (st_parameter_dt *dtp, int * nbytes) if (norig != *nbytes) { /* Short read, this shouldn't happen. */ - if (!dtp->u.p.current_unit->pad_status == PAD_YES) + if (!(dtp->u.p.current_unit->pad_status == PAD_YES)) { generate_error (&dtp->common, LIBERROR_EOR, NULL); source = NULL; Grüße, Thomas
pgpL5hMpJ4rVT.pgp
Description: PGP signature