public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31463] New: gfortran prints no warning message when an unset return value is an array
@ 2007-04-03 16:37 michael dot a dot richmond at nasa dot gov
2007-04-03 17:45 ` [Bug fortran/31463] " michael dot a dot richmond at nasa dot gov
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: michael dot a dot richmond at nasa dot gov @ 2007-04-03 16:37 UTC (permalink / raw)
To: gcc-bugs
When I compile the function listed below I receive no diagnostics. It should
say:
test.f90: In function 'test':
test.f90:1: warning: Function return value not set
FUNCTION test() RESULT(f)
REAL, DIMENSION(1) :: f
END FUNCTION test
--
Summary: gfortran prints no warning message when an unset return
value is an array
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: michael dot a dot richmond at nasa dot gov
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31463
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/31463] gfortran prints no warning message when an unset return value is an array
2007-04-03 16:37 [Bug fortran/31463] New: gfortran prints no warning message when an unset return value is an array michael dot a dot richmond at nasa dot gov
@ 2007-04-03 17:45 ` michael dot a dot richmond at nasa dot gov
2007-04-18 5:52 ` fxcoudert at gcc dot gnu dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: michael dot a dot richmond at nasa dot gov @ 2007-04-03 17:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from michael dot a dot richmond at nasa dot gov 2007-04-03 18:45 -------
The following functions should produce a similar warning message:
function test97() result(ps)
character :: ps
end function test97
CHARACTER(*) FUNCTION test105()
i = LEN(test105)
END FUNCTION test105
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31463
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/31463] gfortran prints no warning message when an unset return value is an array
2007-04-03 16:37 [Bug fortran/31463] New: gfortran prints no warning message when an unset return value is an array michael dot a dot richmond at nasa dot gov
2007-04-03 17:45 ` [Bug fortran/31463] " michael dot a dot richmond at nasa dot gov
@ 2007-04-18 5:52 ` fxcoudert at gcc dot gnu dot org
2008-01-28 15:46 ` dfranke at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-04-18 5:52 UTC (permalink / raw)
To: gcc-bugs
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |diagnostic
Last reconfirmed|0000-00-00 00:00:00 |2007-04-18 06:51:53
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31463
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/31463] gfortran prints no warning message when an unset return value is an array
2007-04-03 16:37 [Bug fortran/31463] New: gfortran prints no warning message when an unset return value is an array michael dot a dot richmond at nasa dot gov
2007-04-03 17:45 ` [Bug fortran/31463] " michael dot a dot richmond at nasa dot gov
2007-04-18 5:52 ` fxcoudert at gcc dot gnu dot org
@ 2008-01-28 15:46 ` dfranke at gcc dot gnu dot org
2008-01-29 3:33 ` [Bug fortran/31463] [patch] inconsistent warnings if function return value is not set dfranke at gcc dot gnu dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-01-28 15:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from dfranke at gcc dot gnu dot org 2008-01-28 14:45 -------
Confirmed.
Interestingly:
$> cat pr31463.f90
FUNCTION test() RESULT(f)
REAL :: f ! removed DIMENSION statement
END FUNCTION test
$> gfortran-svn -g -Wall -c pr31463.f90
pr31463.f90:1.25:
FUNCTION test() RESULT(f)
1
Warning: Unused variable 'f' declared at (1)
pr31463.f90: In function 'test':
pr31463.f90:1: warning: Function return value not set
pr31463.f90:1: warning: control reaches end of non-void function
$> gfortran-svn -v
gcc version 4.3.0 20080125 (experimental)
However, the last three lines are issued from the middle-end. On general
agreement, we don't want this to happen.
I think, an additional attribute, e.g. 'is_function_result' should be added to
the symbol (if not otherwise flagged yet). Then, trans_decl.c
(generate_local_decl) could check for this flag, issue a warning and set
TREE_NO_WARNING to gag the middle-end.
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dfranke at gcc dot gnu dot
| |org
Last reconfirmed|2007-04-18 06:51:53 |2008-01-28 14:45:55
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31463
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/31463] [patch] inconsistent warnings if function return value is not set
2007-04-03 16:37 [Bug fortran/31463] New: gfortran prints no warning message when an unset return value is an array michael dot a dot richmond at nasa dot gov
` (2 preceding siblings ...)
2008-01-28 15:46 ` dfranke at gcc dot gnu dot org
@ 2008-01-29 3:33 ` dfranke at gcc dot gnu dot org
2008-01-29 10:18 ` burnus at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-01-29 3:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from dfranke at gcc dot gnu dot org 2008-01-29 01:26 -------
Mine. For patch, see URL above.
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |dfranke at gcc dot gnu dot
|dot org |org
URL| |http://gcc.gnu.org/ml/fortra
| |n/2008-01/msg00355.html
Status|NEW |ASSIGNED
Keywords| |patch
Last reconfirmed|2008-01-28 14:45:55 |2008-01-29 01:26:18
date| |
Summary|gfortran prints no warning |[patch] inconsistent
|message when an unset return|warnings if function return
|value is an array |value is not set
Target Milestone|--- |4.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31463
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/31463] [patch] inconsistent warnings if function return value is not set
2007-04-03 16:37 [Bug fortran/31463] New: gfortran prints no warning message when an unset return value is an array michael dot a dot richmond at nasa dot gov
` (3 preceding siblings ...)
2008-01-29 3:33 ` [Bug fortran/31463] [patch] inconsistent warnings if function return value is not set dfranke at gcc dot gnu dot org
@ 2008-01-29 10:18 ` burnus at gcc dot gnu dot org
2008-01-29 10:27 ` dfranke at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-01-29 10:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from burnus at gcc dot gnu dot org 2008-01-29 10:05 -------
Daniel's Patch: http://gcc.gnu.org/ml/fortran/2008-01/msg00355.html
Related PRs: PR 34296, PR 33950, and PR 28004.
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31463
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/31463] [patch] inconsistent warnings if function return value is not set
2007-04-03 16:37 [Bug fortran/31463] New: gfortran prints no warning message when an unset return value is an array michael dot a dot richmond at nasa dot gov
` (4 preceding siblings ...)
2008-01-29 10:18 ` burnus at gcc dot gnu dot org
@ 2008-01-29 10:27 ` dfranke at gcc dot gnu dot org
2008-02-28 20:24 ` dfranke at gcc dot gnu dot org
2008-02-28 20:26 ` dfranke at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-01-29 10:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from dfranke at gcc dot gnu dot org 2008-01-29 10:17 -------
> Related PRs: PR 34296, PR 33950, and PR 28004.
Tobias, thanks for the pointers! PRs 34296 and 33950 are (IMO) fixed by this
patch as well (see my comments there). The last one is not affected.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31463
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/31463] [patch] inconsistent warnings if function return value is not set
2007-04-03 16:37 [Bug fortran/31463] New: gfortran prints no warning message when an unset return value is an array michael dot a dot richmond at nasa dot gov
` (5 preceding siblings ...)
2008-01-29 10:27 ` dfranke at gcc dot gnu dot org
@ 2008-02-28 20:24 ` dfranke at gcc dot gnu dot org
2008-02-28 20:26 ` dfranke at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-02-28 20:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from dfranke at gcc dot gnu dot org 2008-02-28 20:23 -------
Subject: Bug 31463
Author: dfranke
Date: Thu Feb 28 20:22:55 2008
New Revision: 132756
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132756
Log:
gcc/fortran:
2008-02-28 Daniel Franke <franke.daniel@gmail.com>
PR fortran/31463
PR fortran/33950
PR fortran/34296
* lang.opt: Added -Wreturn-type.
* options.c (gfc_handle_option): Recognize -Wreturn-type.
* trans-decl.c (gfc_trans_deferred_vars): Emit warnings for funtions
where the result value is not set.
(gfc_generate_function_code): Likewise.
(generate_local_decl): Emit warnings for funtions whose RESULT
variable is not set.
gcc/testsuite:
2008-02-28 Daniel Franke <franke.daniel@gmail.com>
PR fortran/31463
PR fortran/33950
PR fortran/34296
* gfortran.dg/arrayio_11.f90: Fixed test.
* gfortran.dg/arrayio_12.f90: Likewise.
* gfortran.dg/module_read_1.f90: Added warning-directives.
* gfortran.dg/pr32242.f90: Likewise.
* gfortran.dg/result_in_spec_3.f90: Likewise.
* gfortran.dg/use_12.f90: Likewise.
* gfortran.dg/warn_function_without_result.f90 : New test.
Added:
trunk/gcc/testsuite/gfortran.dg/warn_function_without_result.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/lang.opt
trunk/gcc/fortran/options.c
trunk/gcc/fortran/trans-decl.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/arrayio_11.f90
trunk/gcc/testsuite/gfortran.dg/arrayio_12.f90
trunk/gcc/testsuite/gfortran.dg/module_read_1.f90
trunk/gcc/testsuite/gfortran.dg/pr32242.f90
trunk/gcc/testsuite/gfortran.dg/result_in_spec_3.f90
trunk/gcc/testsuite/gfortran.dg/use_12.f90
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31463
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/31463] [patch] inconsistent warnings if function return value is not set
2007-04-03 16:37 [Bug fortran/31463] New: gfortran prints no warning message when an unset return value is an array michael dot a dot richmond at nasa dot gov
` (6 preceding siblings ...)
2008-02-28 20:24 ` dfranke at gcc dot gnu dot org
@ 2008-02-28 20:26 ` dfranke at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-02-28 20:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from dfranke at gcc dot gnu dot org 2008-02-28 20:25 -------
Fixed in trunk. Closing.
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31463
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-02-28 20:26 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-03 16:37 [Bug fortran/31463] New: gfortran prints no warning message when an unset return value is an array michael dot a dot richmond at nasa dot gov
2007-04-03 17:45 ` [Bug fortran/31463] " michael dot a dot richmond at nasa dot gov
2007-04-18 5:52 ` fxcoudert at gcc dot gnu dot org
2008-01-28 15:46 ` dfranke at gcc dot gnu dot org
2008-01-29 3:33 ` [Bug fortran/31463] [patch] inconsistent warnings if function return value is not set dfranke at gcc dot gnu dot org
2008-01-29 10:18 ` burnus at gcc dot gnu dot org
2008-01-29 10:27 ` dfranke at gcc dot gnu dot org
2008-02-28 20:24 ` dfranke at gcc dot gnu dot org
2008-02-28 20:26 ` dfranke at gcc dot gnu dot org
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).