From 1386121ecd068799110d01f01e20e190e3937d25 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sun, 10 Feb 2019 15:38:19 +0000 Subject: [PATCH] re PR fortran/67679 (-Wunitialized reports on compiler-generated variables) 2019-02-10 Thomas Koenig PR fortran/67679 * gfortran.dg/warn_undefined_1.f90: New test. From-SVN: r268747 --- gcc/testsuite/ChangeLog | 5 ++++ .../gfortran.dg/warn_undefined_1.f90 | 28 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/warn_undefined_1.f90 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f7b9f0b69b7..789f5ad3c91 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-02-10 Thomas Koenig + + PR fortran/67679 + * gfortran.dg/warn_undefined_1.f90: New test. + 2019-02-10 Jakub Jelinek PR tree-optimization/89268 diff --git a/gcc/testsuite/gfortran.dg/warn_undefined_1.f90 b/gcc/testsuite/gfortran.dg/warn_undefined_1.f90 new file mode 100644 index 00000000000..67f7ca9cc2f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/warn_undefined_1.f90 @@ -0,0 +1,28 @@ +! { dg-do compile } +! { dg-options "-O2 -Wuninitialized" } +! PR 67679 - this used to cause an undefined warning for +! variables generated by the compiler. + +subroutine s(h, Gmin, r) + + implicit none + real, intent(in) :: Gmin(3), h(3) + integer, intent(inout) :: r + + integer :: x_min(3), x_max(3), k, iStat + logical, dimension(:), allocatable :: check + + do k = 1,1 + x_min(k) = int(Gmin(k)*h(k)) + x_max(k) = int(Gmin(k)*h(k)) + end do + + allocate(check(x_min(1):x_max(1)),stat=iStat) + + check(:) = .false. + + do k = x_min(1),x_max(1) + r = r + 1 + end do + +end -- 2.30.2