diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gfortran.dg/goto_2.f90 | |
download | cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.bz2 cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gfortran.dg/goto_2.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/goto_2.f90 | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/goto_2.f90 b/gcc/testsuite/gfortran.dg/goto_2.f90 new file mode 100644 index 000000000..fc5e8d830 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goto_2.f90 @@ -0,0 +1,59 @@ +! { dg-do run } +! Checks for corrects warnings if branching to then end of a +! construct at various nesting levels + subroutine check_if(i) + goto 10 ! { dg-warning "Label at ... is not in the same block" } + if (i > 0) goto 40 + if (i < 0) then + goto 40 +10 end if ! { dg-warning "Label at ... is not in the same block" } + if (i == 0) then + i = i+1 + goto 20 + goto 40 +20 end if + if (i == 1) then + i = i+1 + if (i == 2) then + goto 30 + end if + goto 40 +30 end if + return +40 i = -1 + end subroutine check_if + + subroutine check_select(i) + goto 10 ! { dg-warning "Label at ... is not in the same block" } + select case (i) + case default + goto 999 +10 end select ! { dg-warning "Label at ... is not in the same block" } + select case (i) + case (2) + i = 1 + goto 20 + goto 999 + case default + goto 999 +20 end select + j = i + select case (j) + case default + select case (i) + case (1) + i = 2 + goto 30 + end select + goto 999 +30 end select + return +999 i = -1 + end subroutine check_select + + i = 0 + call check_if (i) + if (i /= 2) call abort () + call check_select (i) + if (i /= 2) call abort () +end |