aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2013-08-12 05:50:03 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2013-08-12 05:50:03 +0000
commit0e533e50789534e93b1ab0a9dfcb44afa9c94cec (patch)
treec0b67820530848b80905158737ebf6f035db92ad /gcc/fortran/resolve.c
parent4fade8c2c3a1e45834a8c9ec81a91c72a75a8e5a (diff)
downloadgcc-0e533e50789534e93b1ab0a9dfcb44afa9c94cec.zip
gcc-0e533e50789534e93b1ab0a9dfcb44afa9c94cec.tar.gz
gcc-0e533e50789534e93b1ab0a9dfcb44afa9c94cec.tar.bz2
re PR fortran/56666 (Suppression flag for " DO loop at (1) will be executed zero times")
2013-08-12 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/56666 * gfortran.h (gfc_option_t): Add warn_zerotrip. * invoke.texi (-Wzerotrip): Document option. * lang.opt (Wzerotrip): Add. * options.c (gfc_init_options): Initialize warn_zerotrip. (set_Wall): Add handling of warn_zerotrip. (gfc_handle_option): Handle OPT_Wzerotrip. * resolve.c (gfc_resolve_iterator): Honor gfc_option.warn_zerotrip; update error message to show how to suppress the warning. 2013-08-12 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/56666 * gfortran.dg/do_check_10.f90: New test. * gfortran.dg/array_constructor_11.f90: Add -Wzerotrip to dg-options. * gfortran.dg/array_constructor_18.f90: Likewise. * gfortran.dg/array_constructor_22.f90: Likewise. * gfortran.dg/coarray_15.f90: Likewise. * gfortran.dg/do_1.f90: Add -Wall to dg-options. * gfortran.dg/do_3.F90: Add -Wzerotrip to dg-options. * gfortran.dg/do_check_5.f90: Add -Wall to gd-options. From-SVN: r201658
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 837bf15..067288d 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -6281,8 +6281,10 @@ gfc_resolve_iterator (gfc_iterator *iter, bool real_ok, bool own_scope)
sgn = mpfr_sgn (iter->step->value.real);
cmp = mpfr_cmp (iter->end->value.real, iter->start->value.real);
}
- if ((sgn > 0 && cmp < 0) || (sgn < 0 && cmp > 0))
- gfc_warning ("DO loop at %L will be executed zero times",
+ if (gfc_option.warn_zerotrip &&
+ ((sgn > 0 && cmp < 0) || (sgn < 0 && cmp > 0)))
+ gfc_warning ("DO loop at %L will be executed zero times"
+ " (use -Wno-zerotrip to suppress)",
&iter->step->where);
}