public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/64118] New: Strange warning about unused function/subroutine
@ 2014-11-29 22:44 angelo.graziosi at alice dot it
2014-11-30 7:26 ` [Bug fortran/64118] " Joost.VandeVondele at mat dot ethz.ch
2015-04-08 13:57 ` angelo.graziosi at alice dot it
0 siblings, 2 replies; 3+ messages in thread
From: angelo.graziosi at alice dot it @ 2014-11-29 22:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64118
Bug ID: 64118
Summary: Strange warning about unused function/subroutine
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: angelo.graziosi at alice dot it
Created attachment 34144
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34144&action=edit
Tar archive with source code
With the attached tests I get the following warning:
$ gfortran -Wall test_unused_func.f90 -o test_unused_func.out
test_unused_func.f90:54:0: warning: ‘f’ defined but not used
[-Wunused-function]
real(dp) function f(x) result(y)
^
$ gfortran -Wall test_unused_sub.f90 -o test_unused_sub.out
test_unused_sub.f90:44:0: warning: ‘sub3’ defined but not used
[-Wunused-function]
subroutine sub3()
^
test_unused_sub.f90:40:0: warning: ‘sub2’ defined but not used
[-Wunused-function]
subroutine sub2()
^
test_unused_sub.f90:36:0: warning: ‘sub1’ defined but not used
[-Wunused-function]
subroutine sub1()
^
which I find a bit "strange": after all, the function f() in the first test,
for example, is used because it is passed to the call of simpson().. and indeed
$ ./test_unused_func.out
1.4250604553524227
1.9202581413298656
confirming it is _used_!
I found this using gfortran from GCC: 4.8.2 (MSYS2 64), 4.8.3 (OSX+MacPorts 64,
Cygwin64), 4.9.1 (MSYS2+MinGW64), but maybe also recent versions of gfortran
are affected.
The tests are archived in the attached tar-ball.
See also the discussion on gfortran mailing list:
https://gcc.gnu.org/ml/fortran/2014-07/msg00168.html
https://gcc.gnu.org/ml/fortran/2014-11/msg00143.html
Ciao,
Angelo.
>From gcc-bugs-return-468942-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Nov 29 22:45:39 2014
Return-Path: <gcc-bugs-return-468942-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 21401 invoked by alias); 29 Nov 2014 22:45:39 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 20845 invoked by uid 48); 29 Nov 2014 22:45:32 -0000
From: "pab at pabigot dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/64010] [msp430-elf] struct function dereference clobbers parameter passed to function
Date: Sat, 29 Nov 2014 22:45:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: rtl-optimization
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: pab at pabigot dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-64010-4-KdrXE1EroC@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64010-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64010-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-11/txt/msg03414.txt.bz2
Content-length: 689
https://gcc.gnu.org/bugzilla/show_bug.cgi?idd010
Peter A. Bigot <pab at pabigot dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pab at pabigot dot com
--- Comment #1 from Peter A. Bigot <pab at pabigot dot com> ---
Since msp430 maintenance is driven by TI and some fixes don't get pushed
upstream promptly see this E2E post for the status of patches within their fork
of gcc:
http://e2e.ti.com/support/development_tools/compiler/f/343/p/384148/1354847.aspx#1354847
At this time there appears to be no publicly available solution.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/64118] Strange warning about unused function/subroutine
2014-11-29 22:44 [Bug fortran/64118] New: Strange warning about unused function/subroutine angelo.graziosi at alice dot it
@ 2014-11-30 7:26 ` Joost.VandeVondele at mat dot ethz.ch
2015-04-08 13:57 ` angelo.graziosi at alice dot it
1 sibling, 0 replies; 3+ messages in thread
From: Joost.VandeVondele at mat dot ethz.ch @ 2014-11-30 7:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64118
Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-11-30
CC| |Joost.VandeVondele at mat dot ethz
| |.ch
Ever confirmed|0 |1
--- Comment #1 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> ---
confirmed, looks like the -Wunused-function warning doesn't notice if the
address of a function is taken.
One surprising aspect of this 'trick' of taking addresses of functions is that
it makes private procedures of modules available/callable outside of the
module.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/64118] Strange warning about unused function/subroutine
2014-11-29 22:44 [Bug fortran/64118] New: Strange warning about unused function/subroutine angelo.graziosi at alice dot it
2014-11-30 7:26 ` [Bug fortran/64118] " Joost.VandeVondele at mat dot ethz.ch
@ 2015-04-08 13:57 ` angelo.graziosi at alice dot it
1 sibling, 0 replies; 3+ messages in thread
From: angelo.graziosi at alice dot it @ 2015-04-08 13:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64118
--- Comment #2 from Angelo Graziosi <angelo.graziosi at alice dot it> ---
In my original test case, if I move the definition of function f(x) before the
subroutine foo(), does not produce warnings. In other words:
real(dp) function f(x) result(y)
real(dp), intent(in) :: x
y = sin(x)
end function f
subroutine foo()
use integrals, only: simpson
print *, simpson(f, 0.0_dp, 2.0_dp)
print *, simpson(f, 0.0_dp, 4.0_dp)
end subroutine foo
DOES NOT produce warnings. Instead:
subroutine foo()
use integrals, only: simpson
print *, simpson(f, 0.0_dp, 2.0_dp)
print *, simpson(f, 0.0_dp, 4.0_dp)
end subroutine foo
real(dp) function f(x) result(y)
real(dp), intent(in) :: x
y = sin(x)
end function f
DORES PRODUCE warnings!
Ciao,
Angelo.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-04-08 13:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-29 22:44 [Bug fortran/64118] New: Strange warning about unused function/subroutine angelo.graziosi at alice dot it
2014-11-30 7:26 ` [Bug fortran/64118] " Joost.VandeVondele at mat dot ethz.ch
2015-04-08 13:57 ` angelo.graziosi at alice dot it
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).