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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156620
138bc75d-0d04-0410-961f-
82ee72b054a4
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.
@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
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));
}
+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.
+
2010-02-08 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/42890
! { dg-do link }
+! { dg-options "-Wsurprising" }
! Tests the fix for PR 31250
! CHARACTER lengths weren't reduced early enough for all checks of
! them to be meaningful. Furthermore negative string lengths weren't
! dealt with correctly.
CHARACTER(len=0) :: c1 ! This is OK.
-CHARACTER(len=-1) :: c2 ! { dg-warning "CHARACTER variable has zero length" }
+CHARACTER(len=-1) :: c2 ! { dg-warning "has negative length" }
PARAMETER(I=-100)
-CHARACTER(len=I) :: c3 ! { dg-warning "CHARACTER variable has zero length" }
-CHARACTER(len=min(I,500)) :: c4 ! { dg-warning "CHARACTER variable has zero length" }
+CHARACTER(len=I) :: c3 ! { dg-warning "has negative length" }
+CHARACTER(len=min(I,500)) :: c4 ! { dg-warning "has negative length" }
CHARACTER(len=max(I,500)) :: d1 ! no warning
CHARACTER(len=5) :: d2 ! no warning