public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/59749] New: unused warning not emited for unused static struct unles -save-temps is used
@ 2014-01-10  9:19 martin at netbsd dot org
  2014-01-10  9:20 ` [Bug c/59749] " martin at netbsd dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: martin at netbsd dot org @ 2014-01-10  9:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59749
           Summary: unused warning not emited for unused static struct
                    unles -save-temps is used
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: martin at netbsd dot org

Created attachment 31793
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31793&action=edit
original source file exhibiting the problem

I have a program (for the atf testing framework) that is supposed to warn about
an unused variable and (due to -Werror) fail compilation. This works fine with
gcc 4.5.4.

But with 4.8.2 I get:

$ /usr/pkg/gcc48/bin/cc -O2 -c -Wall -Werror /usr/tests/atf/atf-c/unused_test.c
$

The code (after macro expansion) declares a struct and initialize it:

static atfu_this_is_unused_tc_pack = { .m_ident = .... };

and there is no reference to this struct anywhere in the file.

Interestingly when preparing for this ticket I did:

$ /usr/pkg/gcc48/bin/cc -O2 -save-temps -c -Wall -Werror
/usr/tests/atf/atf-c/unused_test.c
/usr/tests/atf/atf-c/unused_test.c:41:123: error: 'atfu_this_is_unused_tc'
defined but not used [-Werror=unused-variable]
 ATF_TC(this_is_unused);
                                                                               
                                           ^
cc1: all warnings being treated as errors
$   /usr/pkg/gcc48/bin/cc -v                             Using built-in specs.
COLLECT_GCC=/usr/pkg/gcc48/bin/cc
COLLECT_LTO_WRAPPER=/usr/pkg/gcc48/libexec/gcc/sparc64--netbsd/4.8.2/lto-wrapper
Target: sparc64--netbsd
Configured with: ../gcc-4.8.2/configure --enable-languages='c c++'
--enable-shared --enable-long-long --with-local-prefix=/usr/pkg/gcc48
--enable-libssp --enable-threads=posix --with-boot-ldflags='-static-libstdc++
-static-libgcc -Wl,-R/usr/pkg/lib ' --with-gnu-ld --with-ld=/usr/bin/ld
--with-gnu-as --with-as=/usr/bin/as --disable-nls --with-gmp=/usr/pkg
--with-mpc=/usr/pkg --with-mpfr=/usr/pkg --enable-__cxa_atexit
--with-gxx-include-dir=/usr/pkg/gcc48/include/c++/ --prefix=/usr/pkg/gcc48
--build=sparc64--netbsd --host=sparc64--netbsd --infodir=/usr/pkg/gcc48/info
--mandir=/usr/pkg/gcc48/man
Thread model: posix
gcc version 4.8.2 (GCC)


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

* [Bug c/59749] unused warning not emited for unused static struct unles -save-temps is used
  2014-01-10  9:19 [Bug c/59749] New: unused warning not emited for unused static struct unles -save-temps is used martin at netbsd dot org
@ 2014-01-10  9:20 ` martin at netbsd dot org
  2014-01-14 11:34 ` martin at netbsd dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: martin at netbsd dot org @ 2014-01-10  9:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Martin Husemann <martin at netbsd dot org> ---
Created attachment 31794
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31794&action=edit
unused_test.i file from -save-temps


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

* [Bug c/59749] unused warning not emited for unused static struct unles -save-temps is used
  2014-01-10  9:19 [Bug c/59749] New: unused warning not emited for unused static struct unles -save-temps is used martin at netbsd dot org
  2014-01-10  9:20 ` [Bug c/59749] " martin at netbsd dot org
@ 2014-01-14 11:34 ` martin at netbsd dot org
  2014-03-19 13:46 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: martin at netbsd dot org @ 2014-01-14 11:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Martin Husemann <martin at netbsd dot org> ---
Unfortunately I can not reproduce the issue with the .i file generated with
-save-temps (but still with the original .c file).


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

* [Bug c/59749] unused warning not emited for unused static struct unles -save-temps is used
  2014-01-10  9:19 [Bug c/59749] New: unused warning not emited for unused static struct unles -save-temps is used martin at netbsd dot org
  2014-01-10  9:20 ` [Bug c/59749] " martin at netbsd dot org
  2014-01-14 11:34 ` martin at netbsd dot org
@ 2014-03-19 13:46 ` mpolacek at gcc dot gnu.org
  2014-03-19 15:01 ` martin at netbsd dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-03-19 13:46 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
If the warning is present with .i but not with .c, then we can't do much about
it without the .c file with its headers.


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

* [Bug c/59749] unused warning not emited for unused static struct unles -save-temps is used
  2014-01-10  9:19 [Bug c/59749] New: unused warning not emited for unused static struct unles -save-temps is used martin at netbsd dot org
                   ` (2 preceding siblings ...)
  2014-03-19 13:46 ` mpolacek at gcc dot gnu.org
@ 2014-03-19 15:01 ` martin at netbsd dot org
  2014-03-24 10:47 ` mpolacek at gcc dot gnu.org
  2014-03-26  7:40 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: martin at netbsd dot org @ 2014-03-19 15:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Martin Husemann <martin at netbsd dot org> ---
Yes - I'm still trying to reduce it to a reasonable test case, but in general
it works - so I am confused big time.
Also Julio (the ATF author) claims the same test works on FreeBSD with a very
similar compiler version.


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

* [Bug c/59749] unused warning not emited for unused static struct unles -save-temps is used
  2014-01-10  9:19 [Bug c/59749] New: unused warning not emited for unused static struct unles -save-temps is used martin at netbsd dot org
                   ` (3 preceding siblings ...)
  2014-03-19 15:01 ` martin at netbsd dot org
@ 2014-03-24 10:47 ` mpolacek at gcc dot gnu.org
  2014-03-26  7:40 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-03-24 10:47 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2014-03-24
     Ever confirmed|0                           |1

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Waiting for a test case.


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

* [Bug c/59749] unused warning not emited for unused static struct unles -save-temps is used
  2014-01-10  9:19 [Bug c/59749] New: unused warning not emited for unused static struct unles -save-temps is used martin at netbsd dot org
                   ` (4 preceding siblings ...)
  2014-03-24 10:47 ` mpolacek at gcc dot gnu.org
@ 2014-03-26  7:40 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-03-26  7:40 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Actually I think this is a dup.

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


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

end of thread, other threads:[~2014-03-26  7:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-10  9:19 [Bug c/59749] New: unused warning not emited for unused static struct unles -save-temps is used martin at netbsd dot org
2014-01-10  9:20 ` [Bug c/59749] " martin at netbsd dot org
2014-01-14 11:34 ` martin at netbsd dot org
2014-03-19 13:46 ` mpolacek at gcc dot gnu.org
2014-03-19 15:01 ` martin at netbsd dot org
2014-03-24 10:47 ` mpolacek at gcc dot gnu.org
2014-03-26  7:40 ` mpolacek 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).