From: Thomas Koenig Date: Tue, 16 Aug 2005 20:26:04 +0000 (+0000) Subject: re PR libfortran/23428 (inquire(iolength= ) for complex give incorrect value) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=950ad21d343bd853bc6355adf8a36ca642e9b759;p=gcc.git re PR libfortran/23428 (inquire(iolength= ) for complex give incorrect value) 2005-08-16 Thomas Koenig PR libfortran/23428 * io/transfer.c (iolength_transfer): Remove __attribute__ ((unused)) from type. Return correct length for inquire(iolength=) for complex variables. 2005-08-16 Thomas Koenig PR libfortran/23428 * gfortran.dg/inquire-complex.f90: New test case. From-SVN: r103168 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 75ab35f6963..179e2dc99b5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-08-16 Thomas Koenig + + PR libfortran/23428 + * gfortran.dg/inquire-complex.f90: New test case. + 2005-08-16 James E Wilson PR tree-optimization/21105 diff --git a/gcc/testsuite/gfortran.dg/inquire-complex.f90 b/gcc/testsuite/gfortran.dg/inquire-complex.f90 new file mode 100644 index 00000000000..188c932084c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/inquire-complex.f90 @@ -0,0 +1,13 @@ +! { dg-do run } +! PR 23428: Inquire(iolength) used to give the wrong result. +program main + implicit none + integer s4, s8 + + complex(kind=8) c8 + complex(kind=4) c4 + + inquire (iolength=s) c8 + if (s4 /= 8 .or. s8 /= 16) call abort + +end program main diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 223567c7c42..7ed94299cdc 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,10 @@ +2005-08-16 Thomas Koenig + + PR libfortran/23428 + * io/transfer.c (iolength_transfer): Remove __attribute__ ((unused)) + from type. Return correct length for inquire(iolength=) + for complex variables. + 2005-08-11 Francois-Xavier Coudert Steven Bosscher diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 00e8c3101d1..03708f84da1 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -1536,12 +1536,16 @@ finalize_transfer (void) data transfer, it just updates the length counter. */ static void -iolength_transfer (bt type __attribute__ ((unused)), - void *dest __attribute__ ((unused)), +iolength_transfer (bt type , void *dest __attribute__ ((unused)), int len) { if (ioparm.iolength != NULL) - *ioparm.iolength += len; + { + if (type == BT_COMPLEX) + *ioparm.iolength += 2*len; + else + *ioparm.iolength += len; + } }