mirror of git://gcc.gnu.org/git/gcc.git
transfer.c (unformatted_read): Use size from front end eliminating use of size_from_real_kind.
2007-05-25 Jerry DeLisle <jvdelisle@gcc.gnu.org> * io/transfer.c (unformatted_read): Use size from front end eliminating use of size_from_real_kind. (unformatted_write): Ditto. From-SVN: r125064
This commit is contained in:
parent
fc6c9f75ef
commit
853c0ad7f0
|
|
@ -1,3 +1,8 @@
|
||||||
|
2007-05-25 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||||
|
|
||||||
|
* io/transfer.c (unformatted_read): Use size from front end eliminating
|
||||||
|
use of size_from_real_kind. (unformatted_write): Ditto.
|
||||||
|
|
||||||
2007-05-23 Steve Ellcey <sje@cup.hp.com>
|
2007-05-23 Steve Ellcey <sje@cup.hp.com>
|
||||||
|
|
||||||
* Makefile.in: Regenerate.
|
* Makefile.in: Regenerate.
|
||||||
|
|
|
||||||
|
|
@ -695,7 +695,7 @@ write_buf (st_parameter_dt *dtp, void *buf, size_t nbytes)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
unformatted_read (st_parameter_dt *dtp, bt type,
|
unformatted_read (st_parameter_dt *dtp, bt type,
|
||||||
void *dest, int kind,
|
void *dest, int kind __attribute__((unused)),
|
||||||
size_t size, size_t nelems)
|
size_t size, size_t nelems)
|
||||||
{
|
{
|
||||||
size_t i, sz;
|
size_t i, sz;
|
||||||
|
|
@ -723,40 +723,37 @@ unformatted_read (st_parameter_dt *dtp, bt type,
|
||||||
/* By now, all complex variables have been split into their
|
/* By now, all complex variables have been split into their
|
||||||
constituent reals. */
|
constituent reals. */
|
||||||
|
|
||||||
if (type == BT_REAL || type == BT_COMPLEX)
|
|
||||||
sz = size_from_real_kind (kind);
|
|
||||||
else
|
|
||||||
sz = kind;
|
|
||||||
|
|
||||||
for (i=0; i<nelems; i++)
|
for (i=0; i<nelems; i++)
|
||||||
{
|
{
|
||||||
read_block_direct (dtp, buffer, &sz);
|
read_block_direct (dtp, buffer, &size);
|
||||||
reverse_memcpy (p, buffer, sz);
|
reverse_memcpy (p, buffer, size);
|
||||||
p += size;
|
p += size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Master function for unformatted writes. */
|
/* Master function for unformatted writes. NOTE: For kind=10 the size is 16
|
||||||
|
bytes on 64 bit machines. The unused bytes are not initialized and never
|
||||||
|
used, which can show an error with memory checking analyzers like
|
||||||
|
valgrind. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
unformatted_write (st_parameter_dt *dtp, bt type,
|
unformatted_write (st_parameter_dt *dtp, bt type,
|
||||||
void *source, int kind,
|
void *source, int kind __attribute__((unused)),
|
||||||
size_t size, size_t nelems)
|
size_t size, size_t nelems)
|
||||||
{
|
{
|
||||||
if (dtp->u.p.current_unit->flags.convert == CONVERT_NATIVE ||
|
if (dtp->u.p.current_unit->flags.convert == CONVERT_NATIVE ||
|
||||||
size == 1 || type == BT_CHARACTER)
|
size == 1 || type == BT_CHARACTER)
|
||||||
{
|
{
|
||||||
size *= nelems;
|
size *= nelems;
|
||||||
|
|
||||||
write_buf (dtp, source, size);
|
write_buf (dtp, source, size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char buffer[16];
|
char buffer[16];
|
||||||
char *p;
|
char *p;
|
||||||
size_t i, sz;
|
size_t i;
|
||||||
|
|
||||||
/* Break up complex into its constituent reals. */
|
/* Break up complex into its constituent reals. */
|
||||||
if (type == BT_COMPLEX)
|
if (type == BT_COMPLEX)
|
||||||
|
|
@ -770,16 +767,12 @@ unformatted_write (st_parameter_dt *dtp, bt type,
|
||||||
/* By now, all complex variables have been split into their
|
/* By now, all complex variables have been split into their
|
||||||
constituent reals. */
|
constituent reals. */
|
||||||
|
|
||||||
if (type == BT_REAL || type == BT_COMPLEX)
|
|
||||||
sz = size_from_real_kind (kind);
|
|
||||||
else
|
|
||||||
sz = kind;
|
|
||||||
|
|
||||||
for (i=0; i<nelems; i++)
|
for (i=0; i<nelems; i++)
|
||||||
{
|
{
|
||||||
reverse_memcpy(buffer, p, size);
|
reverse_memcpy(buffer, p, size);
|
||||||
p+= size;
|
p+= size;
|
||||||
write_buf (dtp, buffer, sz);
|
write_buf (dtp, buffer, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue