From 418a78fa4f1cf57ec41ce66ce0df1edbee83cef7 Mon Sep 17 00:00:00 2001 From: Francois-Xavier Coudert Date: Sat, 10 Dec 2005 22:44:43 +0100 Subject: [PATCH] re PR fortran/25068 ([4.0/4.1] IOSTAT should be default integer when -std=f95) PR fortran/25068 * io.c (resolve_tag): Add correct diagnostic for F2003 feature. * gfortran.dg/iostat_3.f90: New test. From-SVN: r108360 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/io.c | 10 ++++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/iostat_3.f90 | 8 ++++++++ 4 files changed, 28 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/iostat_3.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index e9a8f308dae..ac80fd7392b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2005-12-10 Francois-Xavier Coudert + + PR fortran/25068 + * io.c (resolve_tag): Add correct diagnostic for F2003 feature. + 2005-12-10 Thomas Koenig PR fortran/23815 diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 090f905ea30..6d3d94b7ffb 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -1046,12 +1046,22 @@ resolve_tag (const io_tag * tag, gfc_expr * e) gfc_error ("%s tag at %L must be scalar", tag->name, &e->where); return FAILURE; } + if (tag == &tag_iomsg) { if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: IOMSG tag at %L", &e->where) == FAILURE) return FAILURE; } + + if (tag == &tag_iostat && e->ts.kind != gfc_default_integer_kind) + { + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Non-default " + "integer kind in IOSTAT tag at %L", + &e->where) == FAILURE) + return FAILURE; + } + if (tag == &tag_convert) { if (gfc_notify_std (GFC_STD_GNU, "Extension: CONVERT tag at %L", diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8c170f04102..1eb55cf1d4d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-12-10 Francois-Xavier Coudert + + PR fortran/25068 + * gfortran.dg/iostat_3.f90: New test. + 2005-12-10 Thomas Koenig PR fortran/23815 diff --git a/gcc/testsuite/gfortran.dg/iostat_3.f90 b/gcc/testsuite/gfortran.dg/iostat_3.f90 new file mode 100644 index 00000000000..db9547b29e0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/iostat_3.f90 @@ -0,0 +1,8 @@ +! { dg-do compile } +! Testcase for PR libfortran/25068 + real :: u + integer(kind=8) :: i + open (10,status="scratch") + read (10,*,iostat=i) u ! { dg-warning "Fortran 2003: Non-default integer kind in IOSTAT tag" } + close (10,iostat=i) ! { dg-warning "Fortran 2003: Non-default integer kind in IOSTAT tag" } + end