[Bug fortran/31463] gfortran prints no warning message when an unset return value is an array

dfranke at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Jan 28 15:46:00 GMT 2008



------- 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



More information about the Gcc-bugs mailing list