diff options
author | Fritz Reese <fritzoreese@gmail.com> | 2016-10-25 15:24:36 +0000 |
---|---|---|
committer | Fritz Reese <foreese@gcc.gnu.org> | 2016-10-25 15:24:36 +0000 |
commit | 90051c26da7abd0999ce0afdd9471e354009b861 (patch) | |
tree | e01b0eb63f28905e753fbf1c8cd6160907cdfc2b /gcc/testsuite | |
parent | ef14476730875df063a5788a0072984e22b7c2ec (diff) | |
download | gcc-90051c26da7abd0999ce0afdd9471e354009b861.zip gcc-90051c26da7abd0999ce0afdd9471e354009b861.tar.gz gcc-90051c26da7abd0999ce0afdd9471e354009b861.tar.bz2 |
Support TYPE as alias for PRINT with -fdec.
gcc/fortran/
* decl.c (gfc_match_type): New function.
* match.h (gfc_match_type): New function.
* match.c (gfc_match_if): Special case for one-line IFs.
* gfortran.texi: Update documentation.
* parse.c (decode_statement): Invoke gfc_match_type.
gcc/testsuite/gfortran.dg/
* dec_type_print.f90: New testcase.
From-SVN: r241518
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/dec_type_print.f90 | 84 |
2 files changed, 90 insertions, 2 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b2662db..a64e74d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,7 +1,11 @@ 2016-10-25 Fritz Reese <fritzoreese@gmail.com> - gfortran.dg/ - * feed_1.f90, feed_2.f90: New testcases. + * gfortran.dg/dec_type_print.f90: New testcase. + +2016-10-25 Fritz Reese <fritzoreese@gmail.com> + + * gfortran.dg/feed_1.f90: New test. + * gfortran.dg/feed_2.f90: New test. 2016-10-25 Martin Liska <mliska@suse.cz> diff --git a/gcc/testsuite/gfortran.dg/dec_type_print.f90 b/gcc/testsuite/gfortran.dg/dec_type_print.f90 new file mode 100644 index 0000000..ca40798 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dec_type_print.f90 @@ -0,0 +1,84 @@ +! { dg-do compile } +! { dg-options "-fdec" } +! +! Test the usage of TYPE as an alias for PRINT. +! +! Note the heavy use of other TYPE statements to test for +! regressions involving ambiguity. +! +program main + +logical bool +integer i /0/, j /1/, k /2/ +character(*), parameter :: fmtstr = "(A11)" +namelist /nmlist/ i, j, k +integer, parameter :: n = 5 +real a(n) + +! derived type declarations +type is + integer i +end type + +type point + real x, y +end type point + +type, extends(point) :: point_3d + real :: z +end type point_3d + +type, extends(point) :: color_point + integer :: color +end type color_point + +! declaration type specification +type(is) x +type(point), target :: p +type(point_3d), target :: p3 +type(color_point), target :: c +class(point), pointer :: p_or_c + +! select type +p_or_c => c +select type ( a => p_or_c ) + class is ( point ) + print *, "point" ! <=== + type is ( point_3d ) + print *, "point 3D" +end select + +! Type as alias for print +type* +type * +type*,'St','ar' +type *, 'St', 'ar' +type 10, 'Integer literal' +type 10, 'Integer variable' +type '(A11)', 'Character literal' +type fmtstr, 'Character variable' +type nmlist ! namelist + +a(1) = 0 +call f(.true., a, n) + +10 format (A11) + +end program + + +subroutine f(b,a,n) + implicit none + logical b + real a(*) + integer n + + integer i + + do i = 2,n + a(i) = 2 * (a(i-1) + 1) + if (b) type*,a(i) ! test TYPE as PRINT inside one-line IF + enddo + + return +end subroutine |