public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/50923] New: [4.4/4.5/4.6/4.7 Regression] No warning if function return value is not set
@ 2011-10-30 17:21 burnus at gcc dot gnu.org
  2011-10-30 21:56 ` [Bug fortran/50923] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-10-30 17:21 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50923
           Summary: [4.4/4.5/4.6/4.7 Regression] No warning if function
                    return value is not set
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


The following program compiles without any warning (not even with -Wall
-Wextra).

Expected: A default-option warning like:

  integer pure function f()
  1
  Warning: Return value of function 'f' at (1) not set

Note: If one has a non-contained function, gfortran prints the warning shown
above - but for internal functions or module functions it does not. It also
works if one specifies a result(variable).

Note 2: In GCC 4.3 and earlier, the warning was printed by the middle end.


module m
contains
  integer pure function f()
  end function f
end module m


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

* [Bug fortran/50923] [4.4/4.5/4.6/4.7 Regression] No warning if function return value is not set
  2011-10-30 17:21 [Bug fortran/50923] New: [4.4/4.5/4.6/4.7 Regression] No warning if function return value is not set burnus at gcc dot gnu.org
@ 2011-10-30 21:56 ` rguenth at gcc dot gnu.org
  2011-11-05 12:11 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-10-30 21:56 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.4.7


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

* [Bug fortran/50923] [4.4/4.5/4.6/4.7 Regression] No warning if function return value is not set
  2011-10-30 17:21 [Bug fortran/50923] New: [4.4/4.5/4.6/4.7 Regression] No warning if function return value is not set burnus at gcc dot gnu.org
  2011-10-30 21:56 ` [Bug fortran/50923] " rguenth at gcc dot gnu.org
@ 2011-11-05 12:11 ` rguenth at gcc dot gnu.org
  2011-11-05 12:12 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-11-05 12:11 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-11-05
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-11-05 12:11:18 UTC ---
The fortran frontend emits

f ()
{

}

in this the middle-end does not warn because TREE_NO_WARNING is set
on the function decl by the frontend:

      if (result == NULL_TREE)
        {
          /* TODO: move to the appropriate place in resolve.c.  */
          if (warn_return_type && !sym->attr.referenced && sym == sym->result)
            gfc_warning ("Return value of function '%s' at %L not set",
                         sym->name, &sym->declared_at);

          TREE_NO_WARNING(sym->backend_decl) = 1;


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

* [Bug fortran/50923] [4.4/4.5/4.6/4.7 Regression] No warning if function return value is not set
  2011-10-30 17:21 [Bug fortran/50923] New: [4.4/4.5/4.6/4.7 Regression] No warning if function return value is not set burnus at gcc dot gnu.org
  2011-10-30 21:56 ` [Bug fortran/50923] " rguenth at gcc dot gnu.org
  2011-11-05 12:11 ` rguenth at gcc dot gnu.org
@ 2011-11-05 12:12 ` rguenth at gcc dot gnu.org
  2011-12-09  8:19 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-11-05 12:12 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4


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

* [Bug fortran/50923] [4.4/4.5/4.6/4.7 Regression] No warning if function return value is not set
  2011-10-30 17:21 [Bug fortran/50923] New: [4.4/4.5/4.6/4.7 Regression] No warning if function return value is not set burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-11-05 12:12 ` rguenth at gcc dot gnu.org
@ 2011-12-09  8:19 ` burnus at gcc dot gnu.org
  2011-12-11 20:57 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-12-09  8:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-12-09 08:07:23 UTC ---
Patch, posted for review:
  http://gcc.gnu.org/ml/fortran/2011-11/msg00253.html


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

* [Bug fortran/50923] [4.4/4.5/4.6/4.7 Regression] No warning if function return value is not set
  2011-10-30 17:21 [Bug fortran/50923] New: [4.4/4.5/4.6/4.7 Regression] No warning if function return value is not set burnus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-12-09  8:19 ` burnus at gcc dot gnu.org
@ 2011-12-11 20:57 ` burnus at gcc dot gnu.org
  2011-12-11 23:41 ` burnus at gcc dot gnu.org
  2011-12-12  8:49 ` burnus at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-12-11 20:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-12-11 20:44:32 UTC ---
Author: burnus
Date: Sun Dec 11 20:44:30 2011
New Revision: 182211

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182211
Log:
2011-12-11  Tobias Burnus  <burnus@net-b.de>

        PR fortran/50923
        * trans-decl.c (generate_local_decl): Set TREE_NO_WARNING only
        if the front end has printed a warning.
        (gfc_generate_function_code): Fix unset-result warning.

2011-12-11  Tobias Burnus  <burnus@net-b.de>

        PR fortran/50923
        * gfortran.dg/warn_function_without_result_2.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/warn_function_without_result_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/50923] [4.4/4.5/4.6/4.7 Regression] No warning if function return value is not set
  2011-10-30 17:21 [Bug fortran/50923] New: [4.4/4.5/4.6/4.7 Regression] No warning if function return value is not set burnus at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2011-12-11 20:57 ` burnus at gcc dot gnu.org
@ 2011-12-11 23:41 ` burnus at gcc dot gnu.org
  2011-12-12  8:49 ` burnus at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-12-11 23:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-12-11 21:37:58 UTC ---
Author: burnus
Date: Sun Dec 11 21:37:55 2011
New Revision: 182213

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182213
Log:
2011-12-11  Tobias Burnus  <burnus@net-b.de>

        PR fortran/50923
        * trans-decl.c (generate_local_decl): Set TREE_NO_WARNING only
        if the front end has printed a warning.
        (gfc_generate_function_code): Fix unset-result warning.

2011-12-11  Tobias Burnus  <burnus@net-b.de>

        PR fortran/50923
        * gfortran.dg/warn_function_without_result_2.f90: New.


Added:
   
branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/warn_function_without_result_2.f90
Modified:
    branches/gcc-4_6-branch/gcc/fortran/ChangeLog
    branches/gcc-4_6-branch/gcc/fortran/trans-decl.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/50923] [4.4/4.5/4.6/4.7 Regression] No warning if function return value is not set
  2011-10-30 17:21 [Bug fortran/50923] New: [4.4/4.5/4.6/4.7 Regression] No warning if function return value is not set burnus at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2011-12-11 23:41 ` burnus at gcc dot gnu.org
@ 2011-12-12  8:49 ` burnus at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-12-12  8:49 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.4.7                       |4.6.3

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-12-12 08:46:46 UTC ---
FIXED on the 4.7 trunk and on the 4.6 branch.


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

end of thread, other threads:[~2011-12-12  8:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-30 17:21 [Bug fortran/50923] New: [4.4/4.5/4.6/4.7 Regression] No warning if function return value is not set burnus at gcc dot gnu.org
2011-10-30 21:56 ` [Bug fortran/50923] " rguenth at gcc dot gnu.org
2011-11-05 12:11 ` rguenth at gcc dot gnu.org
2011-11-05 12:12 ` rguenth at gcc dot gnu.org
2011-12-09  8:19 ` burnus at gcc dot gnu.org
2011-12-11 20:57 ` burnus at gcc dot gnu.org
2011-12-11 23:41 ` burnus at gcc dot gnu.org
2011-12-12  8:49 ` burnus at gcc dot gnu.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).