This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Fortran, patch] Fix for PR fortran/26054: Gratuitous warning about Fortran 2003 features.
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Cc: moene at knmi dot nl, toon at moene dot indiv dot nluug dot nl
- Date: Sat, 11 Feb 2006 14:48:28 +0100
- Subject: [Fortran, patch] Fix for PR fortran/26054: Gratuitous warning about Fortran 2003 features.
I agree with the submitter of this bug report that we should
not warn *by default* about the Fortran 2003 features we support.
There are other extensions to the Fortran 95 standard that won't
ever be in any standard that we silently support, like REAL*8.
This is my proposal to deal with this bug report:
- - - - - - - - - - - 8< - - - - - - - - - - - 8< - - - - - - - - - -
2006-02-11 Toon Moene <toon@moene.indiv.nluug.nl>
* fortran/options.c: Do not warn for Fortran 2003 features
by default.
* testsuite/gfortran.dg/enum_8.f90: Remove check for warning.
* testsuite/gfortran.dg/iomsg_1.f90: Ditto.
* testsuite/gfortran.dg/enum_1.f90: Ditto.
* testsuite/gfortran.dg/enum_9.f90: Ditto.
* testsuite/gfortran.dg/enum_2.f90: Ditto.
* testsuite/gfortran.dg/enum_10.f90: Ditto.
* testsuite/gfortran.dg/enum_3.f90: Ditto.
* testsuite/gfortran.dg/flush_1.f90: Ditto.
* testsuite/gfortran.dg/enum_4.f90: Ditto.
* testsuite/gfortran.dg/enum_5.f90: Ditto.
* testsuite/gfortran.dg/enum_6.f90: Ditto.
* testsuite/gfortran.dg/enum_7.f90: Ditto.
* testsuite/gfortran.dg/array_constructor_1.f90: Ditto.
Index: fortran/options.c
===================================================================
--- fortran/options.c (revision 110832)
+++ fortran/options.c (working copy)
@@ -89,7 +89,7 @@
| GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F77 | GFC_STD_GNU
| GFC_STD_LEGACY;
gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
- | GFC_STD_F2003 | GFC_STD_LEGACY;
+ | GFC_STD_LEGACY;
gfc_option.warn_nonstd_intrinsics = 0;
Index: testsuite/gfortran.dg/enum_8.f90
===================================================================
--- testsuite/gfortran.dg/enum_8.f90 (revision 110832)
+++ testsuite/gfortran.dg/enum_8.f90 (working copy)
@@ -4,11 +4,11 @@
program main
implicit none
- enum, bind (c) ! { dg-warning "New in Fortran 2003" }
+ enum, bind (c)
enumerator :: pp , qq = 4294967295, rr ! { dg-error "not initialized with integer" }
end enum ! { dg-error "has no ENUMERATORS" }
- enum, bind (c) ! { dg-warning "New in Fortran 2003" }
+ enum, bind (c)
enumerator :: p , q = 4294967299_8, r ! { dg-error "Arithmetic overflow" }
end enum ! { dg-error "has no ENUMERATORS" }
Index: testsuite/gfortran.dg/iomsg_1.f90
===================================================================
--- testsuite/gfortran.dg/iomsg_1.f90 (revision 110832)
+++ testsuite/gfortran.dg/iomsg_1.f90 (working copy)
@@ -5,24 +5,24 @@
! Test that iomsg is left unchanged with no error
ch = 'asdf'
- open(10, status='scratch', iomsg=ch, iostat=i) ! { dg-warning "Fortran 2003: IOMSG tag" }
+ open(10, status='scratch', iomsg=ch, iostat=i)
if (ch .ne. 'asdf') call abort
! Test iomsg with data transfer statement
- read(10,'(I2)', iomsg=ch, end=100) k ! { dg-warning "Fortran 2003: IOMSG tag" }
+ read(10,'(I2)', iomsg=ch, end=100) k
call abort
100 continue
if (ch .ne. 'End of file') call abort
! Test iomsg with open
- open (-3, err=200, iomsg=ch) ! { dg-warning "Fortran 2003: IOMSG tag" }
+ open (-3, err=200, iomsg=ch)
call abort
200 continue
if (ch .ne. 'Bad unit number in OPEN statement') call abort
! Test iomsg with close
- close(23,status="no_idea", err=500, iomsg=ch) ! { dg-warning "Fortran 2003: IOMSG tag" }
+ close(23,status="no_idea", err=500, iomsg=ch)
500 continue
if (ch .ne. "Bad STATUS parameter in CLOSE statement") call abort
end program iomsg_test
Index: testsuite/gfortran.dg/enum_1.f90
===================================================================
--- testsuite/gfortran.dg/enum_1.f90 (revision 110832)
+++ testsuite/gfortran.dg/enum_1.f90 (working copy)
@@ -3,7 +3,7 @@
program main
implicit none
- enum, bind (c) ! { dg-warning "New in Fortran 2003" }
+ enum, bind (c)
enumerator :: red, black
enumerator blue
end enum
Index: testsuite/gfortran.dg/enum_9.f90
===================================================================
--- testsuite/gfortran.dg/enum_9.f90 (revision 110832)
+++ testsuite/gfortran.dg/enum_9.f90 (working copy)
@@ -4,7 +4,7 @@
program main
implicit none
- enum, bind (c) ! { dg-warning "New in Fortran 2003" }
+ enum, bind (c)
enumerator :: red, black = 127
enumerator blue
end enum
Index: testsuite/gfortran.dg/enum_2.f90
===================================================================
--- testsuite/gfortran.dg/enum_2.f90 (revision 110832)
+++ testsuite/gfortran.dg/enum_2.f90 (working copy)
@@ -3,7 +3,7 @@
program main
implicit none
- enum, bind (c) ! { dg-warning "New in Fortran 2003" }
+ enum, bind (c)
enumerator :: red, black
integer :: x ! { dg-error "Unexpected data declaration" }
enumerator blue = 1 ! { dg-error "Syntax error in ENUMERATOR definition" }
Index: testsuite/gfortran.dg/enum_10.f90
===================================================================
--- testsuite/gfortran.dg/enum_10.f90 (revision 110832)
+++ testsuite/gfortran.dg/enum_10.f90 (working copy)
@@ -5,15 +5,15 @@
! corresponding C type.
module enum_10
-enum, bind( c ) ! { dg-warning "New in Fortran 2003" }
+enum, bind( c )
enumerator :: one1 = 1, two1, max1 = huge(1_1)
end enum
-enum, bind( c ) ! { dg-warning "New in Fortran 2003" }
+enum, bind( c )
enumerator :: one2 = 1, two2, max2 = huge(1_2)
end enum
-enum, bind( c ) ! { dg-warning "New in Fortran 2003" }
+enum, bind( c )
enumerator :: one4 = 1, two4, max4 = huge(1_4)
end enum
end module enum_10
Index: testsuite/gfortran.dg/enum_3.f90
===================================================================
--- testsuite/gfortran.dg/enum_3.f90 (revision 110832)
+++ testsuite/gfortran.dg/enum_3.f90 (working copy)
@@ -3,7 +3,7 @@
program main
implicit none
- enum, bind (c) ! { dg-warning "New in Fortran 2003" }
+ enum, bind (c)
enumerator :: red, black = 2.2 ! { dg-error "initialized with integer expression" }
enumerator :: blue = "x" ! { dg-error "initialized with integer expression" }
end enum ! { dg-error "has no ENUMERATORS" }
Index: testsuite/gfortran.dg/flush_1.f90
===================================================================
--- testsuite/gfortran.dg/flush_1.f90 (revision 110832)
+++ testsuite/gfortran.dg/flush_1.f90 (working copy)
@@ -8,17 +8,17 @@
open (unit=10, access='SEQUENTIAL', status='SCRATCH')
write (10, *) 42
- flush 10 ! { dg-warning "Fortran 2003: FLUSH statement" }
+ flush 10
write (10, *) 42
- flush(10) ! { dg-warning "Fortran 2003: FLUSH statement" }
+ flush(10)
write (10, *) 42
- flush(unit=10, iostat=ios) ! { dg-warning "Fortran 2003: FLUSH statement" }
+ flush(unit=10, iostat=ios)
if (ios /= 0) call abort
write (10, *) 42
- flush (unit=10, err=20) ! { dg-warning "Fortran 2003: FLUSH statement" }
+ flush (unit=10, err=20)
goto 30
20 call abort
30 continue
Index: testsuite/gfortran.dg/enum_4.f90
===================================================================
--- testsuite/gfortran.dg/enum_4.f90 (revision 110832)
+++ testsuite/gfortran.dg/enum_4.f90 (working copy)
@@ -3,12 +3,12 @@
program main
implicit none
- enum, bind (c) ! { dg-warning "New in Fortran 2003" }
+ enum, bind (c)
enumerator :: red, black = 2
enumerator :: blue = 1, red ! { dg-error "already" }
end enum
- enum, bind (c) ! { dg-warning "New in Fortran 2003" }
+ enum, bind (c)
enumerator :: r, b(10) = 2 ! { dg-error "cannot be array" }
enumerator , save :: g = 1 ! { dg-error "cannot have attributes" }
end ! { dg-error " END ENUM" }
Index: testsuite/gfortran.dg/array_constructor_1.f90
===================================================================
--- testsuite/gfortran.dg/array_constructor_1.f90 (revision 110832)
+++ testsuite/gfortran.dg/array_constructor_1.f90 (working copy)
@@ -4,12 +4,12 @@
implicit none
integer :: a(4), i
- a = [ 1, 2, 3, 4 ] ! { dg-warning "array constructor" }
+ a = [ 1, 2, 3, 4 ]
do i = 1, size(a)
if (a(i) /= i) call abort()
end do
- a = [ (/ 1, 2, 3, 4 /) ] ! { dg-warning "array constructor" }
+ a = [ (/ 1, 2, 3, 4 /) ]
do i = 1, size(a)
if (a(i) /= i) call abort()
end do
Index: testsuite/gfortran.dg/enum_5.f90
===================================================================
--- testsuite/gfortran.dg/enum_5.f90 (revision 110832)
+++ testsuite/gfortran.dg/enum_5.f90 (working copy)
@@ -5,7 +5,7 @@
implicit none
integer :: i = 1
- enum, bind (c) ! { dg-warning "New in Fortran 2003" }
+ enum, bind (c)
enumerator :: red, black = i ! { dg-error "is a variable" }
enumerator :: blue = 1
end enum junk ! { dg-error "Syntax error" }
Index: testsuite/gfortran.dg/enum_6.f90
===================================================================
--- testsuite/gfortran.dg/enum_6.f90 (revision 110832)
+++ testsuite/gfortran.dg/enum_6.f90 (working copy)
@@ -5,7 +5,7 @@
implicit none
integer :: i = 1
- enum, bind (c) ! { dg-warning "New in Fortran 2003" }
+ enum, bind (c)
enumerator :: sun, mon = 2
i = 2 ! { dg-error "Unexpected" }
enumerator :: wed = 1
Index: testsuite/gfortran.dg/enum_7.f90
===================================================================
--- testsuite/gfortran.dg/enum_7.f90 (revision 110832)
+++ testsuite/gfortran.dg/enum_7.f90 (working copy)
@@ -4,7 +4,7 @@
program main
implicit none
- enum, bind (c) ! { dg-warning "New in Fortran 2003" }
+ enum, bind (c)
enumerator :: sun, mon = 2
enum, bind (c) ! { dg-error "Unexpected" }
enumerator :: apple, mango
- - - - - - - - - - - 8< - - - - - - - - - - - 8< - - - - - - - - - -
Tested on x86_64-unknown-linux-gnu against the head.
OK for trunk and the 4.1 branch ?
--
Toon Moene - e-mail: toon@moene.indiv.nluug.nl - phone: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
A maintainer of GNU Fortran 95: http://gcc.gnu.org/fortran/
My next PC will have a crank