This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/53939] New: allows assignment to INTENT(IN) nested component
- From: "Bil.Kleb at NASA dot gov" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 12 Jul 2012 12:27:57 +0000
- Subject: [Bug fortran/53939] New: allows assignment to INTENT(IN) nested component
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53939
Bug #: 53939
Summary: allows assignment to INTENT(IN) nested component
Classification: Unclassified
Product: gcc
Version: 4.6.2
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: Bil.Kleb@NASA.gov
I cannot get gfortran to complain when I assign something to an INTENT(IN)
variable, viz,
$ gfortran --version | head -1
GNU Fortran (GCC) 4.6.2 20111019 (prerelease)
$ cat > intent.f90 << EOF
module types
type elem_type
integer :: ncell
integer, dimension(:), pointer :: cl2g
end type
type grid_type
integer :: nelem
type(elem_type), dimension(:), pointer :: elem
end type
end module
module nested_intents
use types, only: grid_type
contains
subroutine pass_through( grid )
type(grid_type), intent(in) :: grid
call intent_inout( grid )
end subroutine
subroutine intent_inout( grid )
type(grid_type), intent(in) :: grid ! should produce error: grid changed
integer :: i, j
do i = 1,grid%nelem
do j = 1, grid%elem(i)%ncell
grid%elem(i)%cl2g(j) = grid%elem(i)%cl2g(j) + 1
end do
end do
end subroutine
end module
EOF
% gfortran -c -W -Wall -Wextra -pedantic-errors intent.f90
%
The old DEC compiler complains,
alpha% % fort -what
Compaq Fortran V1.2.0-1882
Compaq Fortran Compiler V1.2.0-1882-48BBF
alpha% fort -c intent.f90
f90: Error: intent.f90, line 24: There is an assignment to a dummy symbol with
the explicit INTENT(IN) attribute [GRID]
grid%elem(i)%cl2g(j) = grid%elem(i)%cl2g(j) + 1
--------^