Question about structures,intent(in),pointer elements
Rimvydas Jasinskas
rimvydasjas@gmail.com
Sat Feb 1 11:17:00 GMT 2014
Hello everyone,
I am dealing with huge dinamic nested structures,
while refactoring code I came up with some issues.
gcc version 4.8.2 20131219 (prerelease) (GCC) on ARCH
There is an example:
$ cat test_intent.f90
subroutine foo(bar1,bar2,bar3,bar4)
implicit none
type type1
logical,pointer :: ll
endtype type1
logical ,intent(in) :: bar1
logical,allocatable,intent(in) :: bar2
logical,pointer ,intent(in) :: bar3
type(type1) ,intent(in) :: bar4
bar1=.false.
bar2=.false.
bar3=.false.
bar4%ll=.false.
endsubroutine foo
$ gfortran -c -Wall -Wextra test_intent.f90 -std=f2003
I quite familiar with f95 std and I would naturally expect to have 4 errors:
Error: Dummy argument 'barX' with INTENT(IN) in variable definition
context (assignment)
Yet I only get 2 and no warnings. In bugzilla
I came across http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53939
Indead in f2003 and f2008 stds this is documented, while in f95 not.
Reduced variant (only bar4) is valid
on all -std={legacy,gnu,f95,f2003,f2008} and no warnings.
Just for bar3 it fails only on -std=f95:
Error: Fortran 2003: POINTER attribute with INTENT attribute
So should -std=f95 accept bar4 case as valid?
Also is it possible to include diagnostic warning under -Wsurprising
for bar3 and bar4 cases, when accepted as valid? This would help a lot.
Something like this:
Warning: Dummy argument 'barX' with INTENT(IN) in variable definition
context (assignment)
Best regards,
RJ
More information about the Fortran
mailing list