[Bug fortran/57596] select type bug with optional variables?
valeryweber at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Jun 13 07:00:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57596
--- Comment #2 from Valery Weber <valeryweber at hotmail dot com> ---
But the selector is not optional. The problem even remains if I
move the optional variables outside the SELECT TYPE (see bellow).
Those 2 codes run just fine with other compilers like ifort or xlf.
Thanks
Valery
MODULE base_types
TYPE :: base_integer_type
INTEGER :: i
END TYPE base_integer_type
TYPE :: base_character_type
CHARACTER( 10 ) :: c
END TYPE base_character_type
END MODULE base_types
PROGRAM main
USE base_types
IMPLICIT NONE
INTEGER::i_val
call get ( i_val=i_val )
write(*,*) 'i_val',i_val
contains
SUBROUTINE get (i_val, c_val)
INTEGER, INTENT( OUT ), OPTIONAL :: i_val
CHARACTER( : ), INTENT( OUT ), ALLOCATABLE, OPTIONAL :: c_val
CLASS( * ), POINTER :: p
TYPE( base_integer_type ),target :: i_base
INTEGER :: i_val_tmp
CHARACTER( 10 ) :: c_val_tmp
i_base%i=-12
p=>i_base
SELECT TYPE( p )
TYPE IS( base_integer_type )
i_val_tmp = p%i
TYPE IS( base_character_type )
c_val_tmp = p%c
CLASS DEFAULT
stop
END SELECT
IF(present(i_val)) i_val = i_val_tmp
if(present(c_val)) c_val = c_val_tmp
END SUBROUTINE get
END PROGRAM main
More information about the Gcc-bugs
mailing list