public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/50669] New: no warning for unused globals
@ 2011-10-08 22:21 jg at jguk dot org
2011-10-09 11:38 ` [Bug c/50669] " rguenth at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: jg at jguk dot org @ 2011-10-08 22:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50669
Bug #: 50669
Summary: no warning for unused globals
Classification: Unclassified
Product: gcc
Version: 4.5.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jg@jguk.org
I see unused warning for item on stack, but not global variale that is unused.
Could gcc also give warnings for unused globals?
jon@laptop:~$ gcc -Wextra -Wunused -Wall -o main main4.c
main4.c: In function ‘main’:
main4.c:9:6: warning: unused variable ‘unused_flag’
Example program follows:
// gcc -Wextra -Wunused -Wall -o main main4.c
int unused_int;
int main(void)
{
int unused_flag;
return 0;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/50669] no warning for unused globals
2011-10-08 22:21 [Bug c/50669] New: no warning for unused globals jg at jguk dot org
@ 2011-10-09 11:38 ` rguenth at gcc dot gnu.org
2011-10-09 16:44 ` jg at jguk dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-10-09 11:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50669
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-10-09 11:38:34 UTC ---
The variable is exported, so it is not known to be unused.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/50669] no warning for unused globals
2011-10-08 22:21 [Bug c/50669] New: no warning for unused globals jg at jguk dot org
2011-10-09 11:38 ` [Bug c/50669] " rguenth at gcc dot gnu.org
@ 2011-10-09 16:44 ` jg at jguk dot org
2011-10-09 19:35 ` pinskia at gcc dot gnu.org
2011-10-10 22:41 ` jg at jguk dot org
3 siblings, 0 replies; 5+ messages in thread
From: jg at jguk dot org @ 2011-10-09 16:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50669
--- Comment #2 from Jon Grant <jg at jguk dot org> 2011-10-09 16:44:18 UTC ---
I could understand this for libraries. However, when linking as an executable
binary, could the global really be still exported?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/50669] no warning for unused globals
2011-10-08 22:21 [Bug c/50669] New: no warning for unused globals jg at jguk dot org
2011-10-09 11:38 ` [Bug c/50669] " rguenth at gcc dot gnu.org
2011-10-09 16:44 ` jg at jguk dot org
@ 2011-10-09 19:35 ` pinskia at gcc dot gnu.org
2011-10-10 22:41 ` jg at jguk dot org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-10-09 19:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50669
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-10-09 19:34:48 UTC ---
(In reply to comment #2)
> I could understand this for libraries. However, when linking as an executable
> binary, could the global really be still exported?
Yes. In fact this is how plugins work in GCC.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/50669] no warning for unused globals
2011-10-08 22:21 [Bug c/50669] New: no warning for unused globals jg at jguk dot org
` (2 preceding siblings ...)
2011-10-09 19:35 ` pinskia at gcc dot gnu.org
@ 2011-10-10 22:41 ` jg at jguk dot org
3 siblings, 0 replies; 5+ messages in thread
From: jg at jguk dot org @ 2011-10-10 22:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50669
--- Comment #4 from Jon Grant <jg at jguk dot org> 2011-10-10 22:41:22 UTC ---
Ok. That makes sense. I confirmed by modifying the test, and having "static int
unused_int;" which gives a warning that it is unused at global scope.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-10-10 22:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-08 22:21 [Bug c/50669] New: no warning for unused globals jg at jguk dot org
2011-10-09 11:38 ` [Bug c/50669] " rguenth at gcc dot gnu.org
2011-10-09 16:44 ` jg at jguk dot org
2011-10-09 19:35 ` pinskia at gcc dot gnu.org
2011-10-10 22:41 ` jg at jguk 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).