public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/54270] New: [4.8 Regression] spurious warning with -Wunused-function
@ 2012-08-15 12:00 janus at gcc dot gnu.org
  2012-08-15 12:38 ` [Bug fortran/54270] " burnus at gcc dot gnu.org
  2012-08-15 12:44 ` burnus at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: janus at gcc dot gnu.org @ 2012-08-15 12:00 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 54270
           Summary: [4.8 Regression] spurious warning with
                    -Wunused-function
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: janus@gcc.gnu.org


Considering the following test case:


module m

  private
  public :: t

contains

  subroutine s
  end subroutine

  subroutine t
    call s
  end subroutine

end module



Compiling this with Wall, I recently get the warning:

warning: ‘s’ defined but not used [-Wunused-function]

This is certainly fake, since s is obviously used. First observed at r190398.


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

* [Bug fortran/54270] [4.8 Regression] spurious warning with -Wunused-function
  2012-08-15 12:00 [Bug fortran/54270] New: [4.8 Regression] spurious warning with -Wunused-function janus at gcc dot gnu.org
@ 2012-08-15 12:38 ` burnus at gcc dot gnu.org
  2012-08-15 12:44 ` burnus at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-08-15 12:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |burnus at gcc dot gnu.org
         Resolution|                            |DUPLICATE

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-08-15 12:38:21 UTC ---
The actual bug is tracked at PR 54224. The problem is that TREE_USED is not
set; I think that's a middle-end issue, but I might be wrong. My impression is
that all front ends to not set TREE_USED for procedure calls and leave that to
the middle end. (The other question is why inlining doesn't work.)

gfortran since 4.8/April marks module procedures as TREE_PUBLIC() = 0 if the
procedure has been explicitly marked as PRIVATE [PR52751, PR40973, PR52916].
(Ditto for module variables; in both cases exceptions exist like a C binding
name or - for procedures - if they are in a PUBLIC generic interface.)

Since recently [PR 54221], they are also marked as TREE_PUBLIC() = 0 if there
is a "PRIVATE"  statement symbol list or -fmodule-private.

Regarding PR middle-end/54224, I am not quite sure whether the FE should do
something or whether to leave it as ME bug. Thus, I kept PR fortran/54221 open
to keep track of it. As it doesn't seem to be a true regression, I didn't flag
the ME bug as regression.

*** This bug has been marked as a duplicate of bug 54224 ***


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

* [Bug fortran/54270] [4.8 Regression] spurious warning with -Wunused-function
  2012-08-15 12:00 [Bug fortran/54270] New: [4.8 Regression] spurious warning with -Wunused-function janus at gcc dot gnu.org
  2012-08-15 12:38 ` [Bug fortran/54270] " burnus at gcc dot gnu.org
@ 2012-08-15 12:44 ` burnus at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-08-15 12:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-08-15 12:44:02 UTC ---
(In reply to comment #0)
> Considering the following test case:

By the way, if you compile your test case with "-O" you will see that the
compiler has properly optimized away the function "s" after inlining the empty
procedure body of "s" in "t". - Thus, that part of the TREE_PUBLIC() = 0 works.


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

end of thread, other threads:[~2012-08-15 12:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-15 12:00 [Bug fortran/54270] New: [4.8 Regression] spurious warning with -Wunused-function janus at gcc dot gnu.org
2012-08-15 12:38 ` [Bug fortran/54270] " burnus at gcc dot gnu.org
2012-08-15 12:44 ` 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).