public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/34296]  New: Intent(out) and character functions with RESULT: Value-not-set warning
@ 2007-11-29 16:03 burnus at gcc dot gnu dot org
  2007-11-29 16:05 ` [Bug fortran/34296] " burnus at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-11-29 16:03 UTC (permalink / raw)
  To: gcc-bugs

The following code does not give a warning:

CHARACTER(2) FUNCTION ctbgt() RESULT(ctab)
END function ctbgt

Only if one removes either the RESULT or changes CHARACTER in, e.g., INTEGER a
warning is shown.

w/ RESULT and INTEGER:
  warning: Function return value not set
w/o RESULT:
  warning: Function does not return a value

 * * *

Similarly for INTENT(OUT) arguments of procedures:

SUBROUTINE ctbgt(ctab)
  INTEGER, intent(out) :: ctab
END SUBROUTINE ctbgt


-- 
           Summary: Intent(out) and character functions with RESULT: Value-
                    not-set warning
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34296


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/34296] Intent(out) and character functions with RESULT: Value-not-set warning
  2007-11-29 16:03 [Bug fortran/34296] New: Intent(out) and character functions with RESULT: Value-not-set warning burnus at gcc dot gnu dot org
@ 2007-11-29 16:05 ` burnus at gcc dot gnu dot org
  2008-01-29 10:18 ` dfranke at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-11-29 16:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-11-29 16:05 -------
I wanted to add that a possible reason for the character FUNCTION problem is
that the value is returned as argument and not as function return value:

   test (__result, .__result)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34296


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/34296] Intent(out) and character functions with RESULT: Value-not-set warning
  2007-11-29 16:03 [Bug fortran/34296] New: Intent(out) and character functions with RESULT: Value-not-set warning burnus at gcc dot gnu dot org
  2007-11-29 16:05 ` [Bug fortran/34296] " burnus at gcc dot gnu dot org
@ 2008-01-29 10:18 ` dfranke at gcc dot gnu dot org
  2008-02-28 20:24 ` dfranke at gcc dot gnu dot org
  2008-02-28 20:28 ` dfranke at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-01-29 10:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dfranke at gcc dot gnu dot org  2008-01-29 10:11 -------
See patch in PR31463. New output for testcase:

$> gfortran-svn -g -c -Wall pr34296.f90
pr34296.f90:1.42:

CHARACTER(2) FUNCTION ctbgt() RESULT(ctab)
                                         1
Warning: Return value 'ctab' of function 'ctbgt' declared at (1) not set


-- 

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
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-01-29 10:11:50
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34296


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/34296] Intent(out) and character functions with RESULT: Value-not-set warning
  2007-11-29 16:03 [Bug fortran/34296] New: Intent(out) and character functions with RESULT: Value-not-set warning burnus at gcc dot gnu dot org
  2007-11-29 16:05 ` [Bug fortran/34296] " burnus at gcc dot gnu dot org
  2008-01-29 10:18 ` dfranke at gcc dot gnu dot org
@ 2008-02-28 20:24 ` dfranke at gcc dot gnu dot org
  2008-02-28 20:28 ` dfranke at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-02-28 20:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dfranke at gcc dot gnu dot org  2008-02-28 20:23 -------
Subject: Bug 34296

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/34296] Intent(out) and character functions with RESULT: Value-not-set warning
  2007-11-29 16:03 [Bug fortran/34296] New: Intent(out) and character functions with RESULT: Value-not-set warning burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-02-28 20:24 ` dfranke at gcc dot gnu dot org
@ 2008-02-28 20:28 ` dfranke at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-02-28 20:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dfranke at gcc dot gnu dot org  2008-02-28 20:27 -------
Both issues fixed in trunk. Closing.

[The second issue, INTENT(out) not set, was already fixed earlier.]


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.4.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34296


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-02-28 20:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-29 16:03 [Bug fortran/34296] New: Intent(out) and character functions with RESULT: Value-not-set warning burnus at gcc dot gnu dot org
2007-11-29 16:05 ` [Bug fortran/34296] " burnus at gcc dot gnu dot org
2008-01-29 10:18 ` dfranke at gcc dot gnu dot org
2008-02-28 20:24 ` dfranke at gcc dot gnu dot org
2008-02-28 20:28 ` 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).