Commit 34022d2b by Jerry DeLisle

re PR fortran/78659 ([F03] Spurious "requires DTIO" reported against namelist statement)

2016-12-06  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/78659
	* resolve.c (resolve_fl_namelist): Remove unneeded error.
	PR fortran/78659
	* gfortran.dg/alloc_comp_constraint_1.f90: Update test.
	* gfortran.dg/alloc_comp_constraint_7.f90: New test.
	* gfortran.dg/namelist_34.f90: Update test.
	* gfortran.dg/namelist_63.f90: Update test.

From-SVN: r243308
parent 0eada321
2016-12-06 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/78659
* resolve.c (resolve_fl_namelist): Remove unneeded error.
2016-12-06 Andre Vehreschild <vehre@gcc.gnu.org> 2016-12-06 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/78226 PR fortran/78226
......
...@@ -13900,15 +13900,7 @@ resolve_fl_namelist (gfc_symbol *sym) ...@@ -13900,15 +13900,7 @@ resolve_fl_namelist (gfc_symbol *sym)
"or POINTER components", nl->sym->name, "or POINTER components", nl->sym->name,
sym->name, &sym->declared_at)) sym->name, &sym->declared_at))
return false; return false;
return true;
if (!dtio)
{
gfc_error ("NAMELIST object %qs in namelist %qs at %L has "
"ALLOCATABLE or POINTER components and thus requires "
"a defined input/output procedure", nl->sym->name,
sym->name, &sym->declared_at);
return false;
}
} }
} }
......
2016-12-06 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/78659
* gfortran.dg/alloc_comp_constraint_1.f90: Update test.
* gfortran.dg/alloc_comp_constraint_7.f90: New test.
* gfortran.dg/namelist_34.f90: Update test.
* gfortran.dg/namelist_63.f90: Update test.
2016-12-06 Robert Suchanek <robert.suchanek@imgtec.com> 2016-12-06 Robert Suchanek <robert.suchanek@imgtec.com>
* gcc.target/mips/msa-builtins-err.c: New test. * gcc.target/mips/msa-builtins-err.c: New test.
......
! { dg-do compile } ! { dg-do compile }
! Check that we don't allow IO or NAMELISTs with types with allocatable ! { dg-options -std=f2003 }
! Check that we don't allow IO of NAMELISTs with types with allocatable
! components (PR 20541) ! components (PR 20541)
program main program main
...@@ -13,8 +14,8 @@ program main ...@@ -13,8 +14,8 @@ program main
type(foo) :: a type(foo) :: a
type(bar) :: b type(bar) :: b
namelist /blah/ a ! { dg-error "has ALLOCATABLE or POINTER components and thus requires a defined input/output" } namelist /blah/ a ! This is allowed under F2003, but not F95
! The following require User Defined Derived Type I/O procedures.
write (*, *) a ! { dg-error "cannot have ALLOCATABLE components" } write (*, *) a ! { dg-error "cannot have ALLOCATABLE components" }
read (*, *) b ! { dg-error "cannot have ALLOCATABLE components" } read (*, *) b ! { dg-error "cannot have ALLOCATABLE components" }
......
! { dg-do compile }
! { dg-options -std=f95 }
! Check that we don't allow types with allocatable
program main
type :: foo
integer :: k
integer, allocatable :: x(:) ! { dg-error "Fortran 2003: ALLOCATABLE" }
end type foo
type :: bar
type(foo) :: x
end type bar
type(foo) :: a
type(bar) :: b
namelist /blah/ a
end program main
! { dg-do compile } ! { dg-do compile }
! ! { dg-options -std=f95 }
! PR fortran/32905 - accepts types with ultimate POINTER components ! PR fortran/32905 - accepts types with ultimate POINTER components
! ! updated for PR78659
MODULE types MODULE types
type :: tp3 type :: tp3
real :: x real :: x
...@@ -22,7 +22,7 @@ MODULE nml ...@@ -22,7 +22,7 @@ MODULE nml
USE types USE types
type(tp1) :: t1 type(tp1) :: t1
type(tp3) :: t3 type(tp3) :: t3
! The following are allowed under f2003.
namelist /a/ t1 ! { dg-error "has ALLOCATABLE or POINTER components and thus requires a defined input/output" } namelist /a/ t1 ! { dg-error "with ALLOCATABLE or POINTER components" }
namelist /b/ t3 ! { dg-error "has ALLOCATABLE or POINTER components and thus requires a defined input/output" } namelist /b/ t3 ! { dg-error "with ALLOCATABLE or POINTER components" }
END MODULE END MODULE
! { dg-do compile } ! { dg-do compile }
! ! { dg-options -std=f95 }
! PR fortran/45530 ! PR fortran/45530, updated for PR78659
! !
! Contributed by david.sagan@gmail.com ! Contributed by david.sagan@gmail.com
! !
...@@ -24,5 +24,6 @@ type region_struct ...@@ -24,5 +24,6 @@ type region_struct
end type end type
type (c_struct) curve(10) type (c_struct) curve(10)
namelist / params / curve ! { dg-error "ALLOCATABLE or POINTER components and thus requires a defined input/output" } ! The following is allowed with f2003.
namelist / params / curve ! { dg-error "ALLOCATABLE or POINTER components" }
end program end program
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment