aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorDaniel Kraft <d@domob.eu>2010-02-09 11:44:33 +0100
committerDaniel Kraft <domob@gcc.gnu.org>2010-02-09 11:44:33 +0100
commit5e1d6b4c155e1ae3ee7e1ce572f2a5d669bffe9a (patch)
tree5bcd189f3e87b31375c8012f64334e51a3ff2214 /gcc/fortran
parentd0d4124c7f721649b7c96993e07e911c300dfdb3 (diff)
downloadgcc-5e1d6b4c155e1ae3ee7e1ce572f2a5d669bffe9a.zip
gcc-5e1d6b4c155e1ae3ee7e1ce572f2a5d669bffe9a.tar.gz
gcc-5e1d6b4c155e1ae3ee7e1ce572f2a5d669bffe9a.tar.bz2
re PR fortran/39171 (Misleading warning for negative character length)
2010-02-09 Daniel Kraft <d@domob.eu> PR fortran/39171 * resolve.c (resolve_charlen): Change warning about negative CHARACTER length to be correct and issue only with -Wsurprising. * invoke.texi (Wsurprising): Mention this new warning that is turned on by -Wsurprising. 2010-02-09 Daniel Kraft <d@domob.eu> PR fortran/39171 * gfortran.dg/char_length_2.f90: Change warning expectations accordingly and pass -Wsurprising as necessary. From-SVN: r156620
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/invoke.texi3
-rw-r--r--gcc/fortran/resolve.c6
3 files changed, 15 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index cd0c1be..3c6d009 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,13 @@
2010-02-09 Daniel Kraft <d@domob.eu>
+ PR fortran/39171
+ * resolve.c (resolve_charlen): Change warning about negative CHARACTER
+ length to be correct and issue only with -Wsurprising.
+ * invoke.texi (Wsurprising): Mention this new warning that is
+ turned on by -Wsurprising.
+
+2010-02-09 Daniel Kraft <d@domob.eu>
+
PR fortran/41507
* intrinsic.texi (MAXVAL): Remove wrong claim that array argument
can be CHARACTER type.
diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi
index 21db293..88a395d 100644
--- a/gcc/fortran/invoke.texi
+++ b/gcc/fortran/invoke.texi
@@ -792,6 +792,9 @@ A TRANSFER specifies a source that is shorter than the destination.
@item
The type of a function result is declared more than once with the same type. If
@option{-pedantic} or standard-conforming mode is enabled, this is an error.
+
+@item
+A @code{CHARACTER} variable is declared with negative length.
@end itemize
@item -Wtabs
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index d0aa6ad..b525e32 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -8559,8 +8559,10 @@ resolve_charlen (gfc_charlen *cl)
value, the length of character entities declared is zero." */
if (cl->length && !gfc_extract_int (cl->length, &i) && i < 0)
{
- gfc_warning_now ("CHARACTER variable has zero length at %L",
- &cl->length->where);
+ if (gfc_option.warn_surprising)
+ gfc_warning_now ("CHARACTER variable at %L has negative length %d,"
+ " the length has been set to zero",
+ &cl->length->where, i);
gfc_replace_expr (cl->length, gfc_int_expr (0));
}