- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'd like to see the Fortran Intel compiler at least give a warning if nested INTENT(in) contains an assigment, viz,
% 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
% ifort --version | head -1
ifort (IFORT) 12.1.3 20120212
% ifort -c -warn -check function_init.f90
[no complaints]
It's antecedent does:
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
--------^
Thanks for consideration,
--
Bil, 757.812.1805
I'd like to see the Fortran Intel compiler at least give a warning if nested INTENT(in) contains an assigment, viz,
% 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
% ifort --version | head -1
ifort (IFORT) 12.1.3 20120212
% ifort -c -warn -check function_init.f90
[no complaints]
It's antecedent does:
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
--------^
Thanks for consideration,
--
Bil, 757.812.1805
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page