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
This commit is contained in:
parent
d0d4124c7f
commit
5e1d6b4c15
@ -1,3 +1,11 @@
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
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
|
||||
|
@ -1,13 +1,14 @@
|
||||
! { 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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user