- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
The following code produces an error.
module
inout_inoutcontains
subroutine
sub1( ptr )integer, pointer, intent( inout ) :: ptrnullify( ptr )end subroutine
subroutine
sub2( ptr )integer, pointer, intent( inout ) :: ptrnullify( ptr )call sub1( ptr ) !**** This is the line of the errorend subroutine
end module
The error is this:
Error1 Error: A pointer dummy argument with the INTENT(IN) attribute shall not appear as an actual argument if the associated dummy argument has the INTENT(OUT) or INTENT(INOUT) attribute. [PTR]S:srcdisk_io_testpointer_to_pointermod.f9022
I'm a little suspicious that there may be a compiler problem since the error message is saying sub2's pointer is intent(in) and not intent(inout), and I can't see why what I have here would be illegal.
- Marcas:
- Intel® Fortran Compiler
Link copiado
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Is there a public list of open compiler bugs? I am doing things with linked lists and a binary tree, and would like to know of any more pointer related gotcha's.
It seems that there is also a problem with modifying the contents of an object pointed to by an intent(in) pointer.
module
pointer_pointertype
data_structinteger :: int_datainteger, pointer :: int_ptrend
typecontains
subroutine
sub1( ptr )implicit nonetype( data_struct ), pointer, intent( in ) :: ptrtype( data_struct ), pointer :: null_ptr => null( )integer, target :: xptr => null_ptr !**** This should cause an error
ptr%int_data = x !**** This should not
ptr%int_ptr => x !**** This should not
end subroutine
subroutine
sub2( ptr )implicit nonetype( data_struct ), pointer, intent( in ) :: ptrtype( data_struct ), pointer :: tmp_ptrinteger, target :: xtmp_ptr => ptr
tmp_ptr%int_data = x
tmp_ptr%int_ptr => x
end subroutine
end module
There are no errors in sub2, and this is the work-around I have for this problem. But the three commented lines in sub1 all
produce errors. I'm a little suspicious since the third line produces the same error as the first line. It seems the compiler
doesn't understand what is going on. These are the errors.
Error1 Error: A pointer dummy argument with the INTENT(IN) attribute shall not appear as an pointer-object in a pointer-assignment-stmt or nullify-stmt. [PTR]S:srcdisk_io_testpointer_to_pointersubr.f9022
Error2 Error: A dummy argument with the INTENT(IN) attribute shall not appear in a variable definition context [PTR]S:srcdisk_io_testpointer_to_pointersubr.f9023
Error3 Error: A pointer dummy argument with the INTENT(IN) attribute shall not appear as an pointer-object in a pointer-assignment-stmt or nullify-stmt. [PTR]S:srcdisk_io_testpointer_to_pointersubr.f9024
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
I will need to study your new example - I'll get back to you on Monday. At first glance, Error 1 seems correct but I agree that the other two may not be.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado

- Subscrever fonte RSS
- Marcar tópico como novo
- Marcar tópico como lido
- Flutuar este Tópico para o utilizador atual
- Marcador
- Subscrever
- Página amigável para impressora