Bug 45131 - [4.6 regression] New Fortran test failures
Summary: [4.6 regression] New Fortran test failures
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Jerry DeLisle
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2010-07-29 14:11 UTC by H.J. Lu
Modified: 2010-08-02 13:19 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-07-31 16:28:49


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2010-07-29 14:11:17 UTC
On Linux/x86-64, when configured with

--with-cpu=atom --enable-clocale=gnu --with-system-zlib --enable-shared --with-demangler-in-ld -with-plugin-ld=ld.gold --enable-gold --with-fpmath=sse 

revision 162667 gave

FAIL: gfortran.dg/inquire_size.f90  -O0  execution test
FAIL: gfortran.dg/inquire_size.f90  -O1  execution test
FAIL: gfortran.dg/inquire_size.f90  -O2  execution test
FAIL: gfortran.dg/inquire_size.f90  -O3 -fomit-frame-pointer  execution test
FAIL: gfortran.dg/inquire_size.f90  -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions  execution test
FAIL: gfortran.dg/inquire_size.f90  -O3 -fomit-frame-pointer -funroll-loops  execution test
FAIL: gfortran.dg/inquire_size.f90  -O3 -g  execution test
FAIL: gfortran.dg/inquire_size.f90  -Os  execution test
FAIL: gfortran.dg/streamio_10.f90  -O0  execution test
FAIL: gfortran.dg/streamio_10.f90  -O1  execution test
FAIL: gfortran.dg/streamio_10.f90  -O2  execution test
FAIL: gfortran.dg/streamio_10.f90  -O3 -fomit-frame-pointer  execution test
FAIL: gfortran.dg/streamio_10.f90  -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions  execution test
FAIL: gfortran.dg/streamio_10.f90  -O3 -fomit-frame-pointer -funroll-loops  execution test
FAIL: gfortran.dg/streamio_10.f90  -O3 -g  execution test
FAIL: gfortran.dg/streamio_10.f90  -Os  execution test
FAIL: gfortran.dg/streamio_15.f90  -O0  execution test
FAIL: gfortran.dg/streamio_15.f90  -O1  execution test
FAIL: gfortran.dg/streamio_15.f90  -O2  execution test
FAIL: gfortran.dg/streamio_15.f90  -O3 -fomit-frame-pointer  execution test
FAIL: gfortran.dg/streamio_15.f90  -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions  execution test
FAIL: gfortran.dg/streamio_15.f90  -O3 -fomit-frame-pointer -funroll-loops  execution test
FAIL: gfortran.dg/streamio_15.f90  -O3 -g  execution test
FAIL: gfortran.dg/streamio_15.f90  -Os  execution test
FAIL: gfortran.dg/streamio_16.f90  -O0  execution test
FAIL: gfortran.dg/streamio_16.f90  -O1  execution test
FAIL: gfortran.dg/streamio_16.f90  -O2  execution test
FAIL: gfortran.dg/streamio_16.f90  -O3 -fomit-frame-pointer  execution test
FAIL: gfortran.dg/streamio_16.f90  -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions  execution test
FAIL: gfortran.dg/streamio_16.f90  -O3 -fomit-frame-pointer -funroll-loops  execution test
FAIL: gfortran.dg/streamio_16.f90  -O3 -g  execution test
FAIL: gfortran.dg/streamio_16.f90  -Os  execution test
FAIL: gfortran.dg/streamio_8.f90  -O0  execution test
FAIL: gfortran.dg/streamio_8.f90  -O1  execution test
FAIL: gfortran.dg/streamio_8.f90  -O2  execution test
FAIL: gfortran.dg/streamio_8.f90  -O3 -fomit-frame-pointer  execution test
FAIL: gfortran.dg/streamio_8.f90  -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions  execution test
FAIL: gfortran.dg/streamio_8.f90  -O3 -fomit-frame-pointer -funroll-loops  execution test
FAIL: gfortran.dg/streamio_8.f90  -O3 -g  execution test
FAIL: gfortran.dg/streamio_8.f90  -Os  execution test
FAIL: gfortran.fortran-torture/execute/inquire_3.f90 execution,  -O0
FAIL: gfortran.fortran-torture/execute/inquire_3.f90 execution,  -O1
FAIL: gfortran.fortran-torture/execute/inquire_3.f90 execution,  -O2
FAIL: gfortran.fortran-torture/execute/inquire_3.f90 execution,  -O2 -fbounds-check
FAIL: gfortran.fortran-torture/execute/inquire_3.f90 execution,  -O2 -fomit-frame-pointer -finline-functions
FAIL: gfortran.fortran-torture/execute/inquire_3.f90 execution,  -O2 -fomit-frame-pointer -finline-functions -funroll-loops
FAIL: gfortran.fortran-torture/execute/inquire_3.f90 execution,  -O3 -g
FAIL: gfortran.fortran-torture/execute/inquire_3.f90 execution,  -Os
FAIL: gfortran.fortran-torture/execute/inquire_3.f90 execution, -O2 -ftree-vectorize -msse2
FAIL: gfortran.fortran-torture/execute/inquire_4.f90 execution,  -O0
FAIL: gfortran.fortran-torture/execute/inquire_4.f90 execution,  -O1
FAIL: gfortran.fortran-torture/execute/inquire_4.f90 execution,  -O2
FAIL: gfortran.fortran-torture/execute/inquire_4.f90 execution,  -O2 -fbounds-check
FAIL: gfortran.fortran-torture/execute/inquire_4.f90 execution,  -O2 -fomit-frame-pointer -finline-functions
FAIL: gfortran.fortran-torture/execute/inquire_4.f90 execution,  -O2 -fomit-frame-pointer -finline-functions -funroll-loops
FAIL: gfortran.fortran-torture/execute/inquire_4.f90 execution,  -O3 -g
FAIL: gfortran.fortran-torture/execute/inquire_4.f90 execution,  -Os
FAIL: gfortran.fortran-torture/execute/inquire_4.f90 execution, -O2 -ftree-vectorize -msse2

Revision 162619 is OK.
Comment 1 H.J. Lu 2010-07-29 14:12:43 UTC
It may be caused by revision 162653:

http://gcc.gnu.org/ml/gcc-cvs/2010-07/msg01007.html
Comment 2 H.J. Lu 2010-07-29 14:16:08 UTC
It happened between revision 162661 and revision 162667.
Comment 3 H.J. Lu 2010-07-29 14:19:36 UTC
It is caused by revision 162667:

http://gcc.gnu.org/ml/gcc-cvs/2010-07/msg01021.html
Comment 4 Tobias Burnus 2010-07-29 14:55:56 UTC
HJ, as it works on most systems, can you do some debugging?

a) Does the system has HAVE_TTYNAME defined for libgfortran/ ?

b) If it fails in the library, how? Otherwise: Which of the asserts fails in the test case? Can you replace for the failing line the "call abort()" by "print *, <variable name>"

I assume, all the failures have the same cause thus it should be sufficient to only analyze one.
Comment 5 H.J. Lu 2010-07-29 15:47:56 UTC
(In reply to comment #4)
> HJ, as it works on most systems, can you do some debugging?

Trunk was broken since yesterday and was fixed a while ago.

> a) Does the system has HAVE_TTYNAME defined for libgfortran/ ?

Yes.

> b) If it fails in the library, how? Otherwise: Which of the asserts fails in
> the test case? Can you replace for the failing line the "call abort()" by
> "print *, <variable name>"
> 

[hjl@gnu-1 gfortran]$ cat inquire_3.f90
! pr14836
       OPEN(UNIT=9, ACCESS='DIRECT', RECL=80, FORM='UNFORMATTED')
       INQUIRE(UNIT=9,NEXTREC=NREC)
       WRITE(UNIT=9,REC=5) 1
       INQUIRE(UNIT=9,NEXTREC=NREC)
       PRINT*,NREC
       IF (NREC.NE.6) CALL ABORT
       READ(UNIT=9,REC=1) MVI
       INQUIRE(UNIT=9,NEXTREC=NREC)
       PRINT*,NREC
       IF (NREC.NE.2) CALL ABORT
       CLOSE(UNIT=9,STATUS='DELETE')
       END

[hjl@gnu-1 gfortran]$ /export/gnu/import/svn/gcc-test/bld/gcc/testsuite/gfortran/../../gfortran -B/export/gnu/import/svn/gcc-test/bld/gcc/testsuite/gfortran/../../ inquire_3.f90  -w  -O0   -B/export/gnu/import/svn/gcc-test/bld/i686-linux/./libgfortran/.libs -L/export/gnu/import/svn/gcc-test/bld/i686-linux/./libgfortran/.libs -L/export/gnu/import/svn/gcc-test/bld/i686-linux/./libgfortran/.libs -L/export/gnu/import/svn/gcc-test/bld/i686-linux/./libiberty  -lm -static
[hjl@gnu-1 gfortran]$ ./a.out 
           1
Aborted
[hjl@gnu-1 gfortran]$ 
Comment 6 Jerry DeLisle 2010-07-30 01:49:50 UTC
This is really odd because the patch does not touch these parts of the library, at least for inquire_3.f90. I wonder if there is something latent here.
Comment 7 Richard Biener 2010-07-30 09:32:23 UTC
I see the same with -m32 on x86_64.  Interestingly I see it with -O0
and libgfortran from 4.5 as well, so it looks like a frontend problem, not
a library problem to me.
Comment 8 Jerry DeLisle 2010-07-30 14:06:25 UTC
#7 confirms my suspicions. I will try to have a look into this in the next few days.  If anyone else has time, please do.
Comment 9 Tobias Burnus 2010-07-30 15:11:57 UTC
I can also reproduce it with -m32 and x86-64. The dump looks OK; if one uses a debugger, one sees that in inquire_via_unit:
   u->last_record == 0 - instead of the expect "5".
but u->flags.access == ACCESS_DIRECT as expected.

I wonder whether the information somehow gets lost due to the new "fn spec" settings for trans-io.c (..._with_spec) - though using ".w" looks ok - additionally, I do not see how the FE could modify the libraries' unit data in such a way.

Side question: Why is st_inquire actually listed as returning an integer if it is void?
 362   parm_type = build_pointer_type (st_parameter[IOPARM_ptype_inquire].type);
 363   iocall[IOCALL_INQUIRE] = gfc_build_library_function_decl_with_spec (
 364         get_identifier (PREFIX("st_inquire")), ".w",
 365         gfc_int4_type_node, 1, parm_type);


Ditto for st_iolength_done, st_flush, st_endfile, st_backspace, st_rewind, and st_wait
Comment 10 Jerry DeLisle 2010-07-31 16:28:48 UTC
I can see one here on a 32 bit machine. Moving string.h down in the file as noted by David Edelsohn fixes it.  I also changed the return type to void in trans-io.c.

Index: inquire.c
===================================================================
--- inquire.c   (revision 162724)
+++ inquire.c   (working copy)
@@ -26,9 +26,9 @@

 /* Implement the non-IOLENGTH variant of the INQUIRY statement */

-#include <string.h>
 #include "io.h"
 #include "unix.h"
+#include <string.h>


 static const char undefined[] = "UNDEFINED";

Comment 11 Jerry DeLisle 2010-07-31 17:04:50 UTC
I see the problem with 4.4.3 as well. I think the patch in #10 is only masking it.
Comment 12 Jerry DeLisle 2010-08-01 17:28:36 UTC
This appears to be fixed now from the commit of patch in #10.  The related failures showing in gcc test results are no longer there.
Comment 13 Tobias Burnus 2010-08-01 19:38:41 UTC
(In reply to comment #12)
> This appears to be fixed now from the commit of patch in #10.

Which is the commit:

Date: Sat Jul 31 21:37:25 2010
New Revision: 162788

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162788
Log:
* io/inquire.c: Include io.h before string.h.

Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/io/inquire.c
Comment 14 Jerry DeLisle 2010-08-02 13:19:08 UTC
Closing as fixed.  Regarding comment #7.  I do not see the problem on 4.5.  I reran tests here on my machine that failed with 4.6 and there were no failures on 4.5