public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/39171] New: Misleading warning for negative character length
@ 2009-02-12 18:19 domob at gcc dot gnu dot org
2009-02-13 10:34 ` [Bug fortran/39171] " burnus at gcc dot gnu dot org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: domob at gcc dot gnu dot org @ 2009-02-12 18:19 UTC (permalink / raw)
To: gcc-bugs
When compiling code with a zero character-length like this:
character(len=0) :: str
end
gfortran gives no error/warning. But for a negative length:
character(len=-1) :: str
end
one gets the misleading message:
character(len=-1) :: str
1
Warning: CHARACTER variable has zero length at (1)
The correct behaviour is to adjust the negative length to zero; zero itself is
fine. Dominique suggested to print this warning instead:
Warning: CHARACTER variable xxx has a negative length,
the length has been set to zero
And instead of always printing this warning, one could make it dependend on
some -W flag.
--
Summary: Misleading warning for negative character length
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: domob at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39171
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/39171] Misleading warning for negative character length
2009-02-12 18:19 [Bug fortran/39171] New: Misleading warning for negative character length domob at gcc dot gnu dot org
@ 2009-02-13 10:34 ` burnus at gcc dot gnu dot org
2009-02-19 5:56 ` pault at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-02-13 10:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from burnus at gcc dot gnu dot org 2009-02-13 10:34 -------
For completeness, the F2003 standard has in "4.4.4 Character type"
"The length is a type parameter; its value is greater than or equal to zero."
and later
"If the character length parameter value evaluates to a negative value, the
length of character entities declared is zero."
Thus len=-1 is valid and equivalent to len=0.
The warning is OK in my opinion as I cannot see any reason why one would like
to have it negative at compile-time (init expression). (Maybe generated
code/preprocessor expressions, but even then a warning might be helpful.)
Whether the warning should be on by default or only with -W... is another
question.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39171
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/39171] Misleading warning for negative character length
2009-02-12 18:19 [Bug fortran/39171] New: Misleading warning for negative character length domob at gcc dot gnu dot org
2009-02-13 10:34 ` [Bug fortran/39171] " burnus at gcc dot gnu dot org
@ 2009-02-19 5:56 ` pault at gcc dot gnu dot org
2009-12-27 9:35 ` domob at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2009-02-19 5:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pault at gcc dot gnu dot org 2009-02-19 05:56 -------
Confirmed
Paul
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-02-19 05:56:36
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39171
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/39171] Misleading warning for negative character length
2009-02-12 18:19 [Bug fortran/39171] New: Misleading warning for negative character length domob at gcc dot gnu dot org
2009-02-13 10:34 ` [Bug fortran/39171] " burnus at gcc dot gnu dot org
2009-02-19 5:56 ` pault at gcc dot gnu dot org
@ 2009-12-27 9:35 ` domob at gcc dot gnu dot org
2010-02-09 10:44 ` domob at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: domob at gcc dot gnu dot org @ 2009-12-27 9:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from domob at gcc dot gnu dot org 2009-12-27 09:34 -------
Will work on this, as Tobias suggested the warning could depend on -Wsurprising
--
domob at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |domob at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2009-02-19 05:56:36 |2009-12-27 09:34:56
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39171
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/39171] Misleading warning for negative character length
2009-02-12 18:19 [Bug fortran/39171] New: Misleading warning for negative character length domob at gcc dot gnu dot org
` (2 preceding siblings ...)
2009-12-27 9:35 ` domob at gcc dot gnu dot org
@ 2010-02-09 10:44 ` domob at gcc dot gnu dot org
2010-02-09 10:45 ` domob at gcc dot gnu dot org
2010-02-23 16:39 ` hjl dot tools at gmail dot com
5 siblings, 0 replies; 7+ messages in thread
From: domob at gcc dot gnu dot org @ 2010-02-09 10:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from domob at gcc dot gnu dot org 2010-02-09 10:44 -------
Subject: Bug 39171
Author: domob
Date: Tue Feb 9 10:44:33 2010
New Revision: 156620
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156620
Log:
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.
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/invoke.texi
trunk/gcc/fortran/resolve.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/char_length_2.f90
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39171
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/39171] Misleading warning for negative character length
2009-02-12 18:19 [Bug fortran/39171] New: Misleading warning for negative character length domob at gcc dot gnu dot org
` (3 preceding siblings ...)
2010-02-09 10:44 ` domob at gcc dot gnu dot org
@ 2010-02-09 10:45 ` domob at gcc dot gnu dot org
2010-02-23 16:39 ` hjl dot tools at gmail dot com
5 siblings, 0 replies; 7+ messages in thread
From: domob at gcc dot gnu dot org @ 2010-02-09 10:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from domob at gcc dot gnu dot org 2010-02-09 10:45 -------
Fixed on trunk.
--
domob at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39171
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/39171] Misleading warning for negative character length
2009-02-12 18:19 [Bug fortran/39171] New: Misleading warning for negative character length domob at gcc dot gnu dot org
` (4 preceding siblings ...)
2010-02-09 10:45 ` domob at gcc dot gnu dot org
@ 2010-02-23 16:39 ` hjl dot tools at gmail dot com
5 siblings, 0 replies; 7+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-02-23 16:39 UTC (permalink / raw)
To: gcc-bugs
--
hjl dot tools at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.5.0
Version|unknown |4.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39171
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-02-23 16:39 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-12 18:19 [Bug fortran/39171] New: Misleading warning for negative character length domob at gcc dot gnu dot org
2009-02-13 10:34 ` [Bug fortran/39171] " burnus at gcc dot gnu dot org
2009-02-19 5:56 ` pault at gcc dot gnu dot org
2009-12-27 9:35 ` domob at gcc dot gnu dot org
2010-02-09 10:44 ` domob at gcc dot gnu dot org
2010-02-09 10:45 ` domob at gcc dot gnu dot org
2010-02-23 16:39 ` hjl dot tools at gmail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).