From 918b6c9ec22543ced2487fd8780049f595a94b38 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Wed, 22 Mar 2017 15:20:17 +0000 Subject: [PATCH] re PR fortran/80142 (Warning: No location in expression ... with -O / -ffrontend-optimize) 2017-03-22 Thomas Koenig PR fortran/80142 * frontend-passes.c (combine_array_constructor): Take location of new expression from constructor expression instead of constructor. 2017-03-22 Thomas Koenig PR fortran/80142 * gfortran.dg/any_loc.f90: New test case. From-SVN: r246388 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/frontend-passes.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/any_loc.f90 | 27 +++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/any_loc.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5c99e1fb24a..1dce756ecc6 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2017-03-22 Thomas Koenig + + PR fortran/80142 + * frontend-passes.c (combine_array_constructor): Take + location of new expression from constructor expression instead + of constructor. + 2017-03-18 Paul Thomas PR fortran/79676 diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index b255e98af31..459967d5c35 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -1381,7 +1381,7 @@ combine_array_constructor (gfc_expr *e) new_expr->ts = e->ts; new_expr->expr_type = EXPR_OP; new_expr->rank = c->expr->rank; - new_expr->where = c->where; + new_expr->where = c->expr->where; new_expr->value.op.op = e->value.op.op; if (scalar_first) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ead24fa48d3..53474a1b1aa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-03-22 Thomas Koenig + + PR fortran/80142 + * gfortran.dg/any_loc.f90: New test case. + 2017-03-22 Thomas Preud'homme PR target/80082 diff --git a/gcc/testsuite/gfortran.dg/any_loc.f90 b/gcc/testsuite/gfortran.dg/any_loc.f90 new file mode 100644 index 00000000000..1a220508d9e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/any_loc.f90 @@ -0,0 +1,27 @@ +! { dg-do compile } +! { dg-options "-ffrontend-optimize" } +! PR fortran/80142 - the location on the expression of the +! unrolled any statement was not correctly set. +! Test case by Harald Anlauf. +MODULE gfcbug140 + implicit none + integer ,parameter :: WV_NONE = 1 + integer, parameter :: WV_CDV_4 = 23 + integer, parameter :: WV_CDV_8 = 24 + integer, parameter :: wv_CDV_list(2) = [ WV_CDV_4, WV_CDV_8 ] + integer :: basis = WV_NONE +contains + subroutine wave_1d (x) + real, intent(inout) :: x(:,:) + integer :: oldbase + oldbase = basis + if (any (basis == wv_CDV_list(:))) then + end if + basis = oldbase + end subroutine wave_1d + !- + subroutine mr_gp_mat (A) + real, intent(inout) :: A (:,:) + call wave_1d (A) + end subroutine mr_gp_mat +end module gfcbug140 -- 2.30.2