public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64079] New: pragma GCC diagnostic ignored "-Wunused-function" has incorrect scope
@ 2014-11-26  6:38 woodroof at gmail dot com
  2015-07-23 13:15 ` [Bug c++/64079] %+D in diagnostics breaks pragma GCC diagnostic manu at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: woodroof at gmail dot com @ 2014-11-26  6:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64079

            Bug ID: 64079
           Summary: pragma GCC diagnostic ignored "-Wunused-function" has
                    incorrect scope
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: woodroof at gmail dot com

Created attachment 34121
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34121&action=edit
preprocessed file

Regression from 4.8.x

Warning "-Wunused-function" is generated even if 
#pragma GCC diagnostic ignored "-Wunused-function"
is defined in place where function is declared/defined.

If there is no "pragma GCC diagnostic push/pop", no warning is generated, even
if "pragma GCC diagnostic ignored" is located at the end of a compilation unit.

*Command line*: g++ -Wall bug.cpp

*Compiler output*:
bug.cpp:11:13: warning: ‘void bar()’ defined but not used [-Wunused-function]
 static void bar() {}
             ^
bug.cpp:7:6: warning: ‘void {anonymous}::foo()’ defined but not used
[-Wunused-function]
 void foo() {}
      ^

*Version*:
g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.9.2-0ubuntu1~14.04' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.9 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify
--enable-plugin --with-system-zlib --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.9.2 (Ubuntu 4.9.2-0ubuntu1~14.04)
>From gcc-bugs-return-468597-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Nov 26 07:17:53 2014
Return-Path: <gcc-bugs-return-468597-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 27614 invoked by alias); 26 Nov 2014 07:17:53 -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 27564 invoked by uid 48); 26 Nov 2014 07:17:49 -0000
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug sanitizer/64078] FAIL: c-c++-common/ubsan/object-size-9.c
Date: Wed, 26 Nov 2014 07:17:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: sanitizer
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: mpolacek at gcc dot gnu.org
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-64078-4-BQx01PnbID@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64078-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64078-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/msg03069.txt.bz2
Content-length: 2088

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd078

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

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

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I haven't seen that yet, though presumably it's about how a struct is padded,
so the following might help

diff --git a/gcc/testsuite/c-c++-common/ubsan/object-size-9.c
b/gcc/testsuite/c-c++-common/ubsan/object-size-9.c
index 829c822..97ef1d9 100644
--- a/gcc/testsuite/c-c++-common/ubsan/object-size-9.c
+++ b/gcc/testsuite/c-c++-common/ubsan/object-size-9.c
@@ -35,7 +35,7 @@ f2 (int i)
   return x;
 }

-/* { dg-output "\[^\n\r]*index 12 out of bounds for type 'char
\\\[8\\\]'\[^\n\r]*(\n|\r\n|\r)" { target { c++ } } } */
+/* { dg-output "\[^\n\r]*index 17 out of bounds for type 'char
\\\[8\\\]'\[^\n\r]*(\n|\r\n|\r)" { target { c++ } } } */
 /* { dg-output "\[^\n\r]*store to address \[^\n\r]* with insufficient space
for an object of type 'char'\[^\n\r]*(\n|\r\n|\r)" { target
 /* { dg-output "\[^\n\r]*note: pointer points here\[^\n\r]*(\n|\r\n|\r)" {
target { c++ } } } */
 /* { dg-output "\[^\n\r]*\[^\n\r]*(\n|\r\n|\r)" { target { c++ } } } */
@@ -64,7 +64,7 @@ f4 (int i)
   return s.d[i].b;
 }

-/* { dg-output "\[^\n\r]*index 12 out of bounds for type 'U
\\\[10\\\]'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*index 17 out of bounds for type 'U
\\\[10\\\]'\[^\n\r]*(\n|\r\n|\r)" } */
 /* { dg-output "\[^\n\r]*load of address \[^\n\r]* with insufficient space for
an object of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" }
 /* { dg-output "\[^\n\r]*note: pointer points here\[^\n\r]*(\n|\r\n|\r)" } */
 /* { dg-output "\[^\n\r]*\[^\n\r]*(\n|\r\n|\r)" } */
@@ -86,12 +86,12 @@ f5 (int i)
 int
 main (void)
 {
-  f1 (t, 12);
+  f1 (t, 17);
 #ifdef __cplusplus
-  f2 (12);
-  f3 (12);
+  f2 (17);
+  f3 (17);
 #endif
-  f4 (12);
-  f5 (12);
+  f4 (17);
+  f5 (17);
   return 0;
 }


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

end of thread, other threads:[~2015-07-25  6:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-26  6:38 [Bug c++/64079] New: pragma GCC diagnostic ignored "-Wunused-function" has incorrect scope woodroof at gmail dot com
2015-07-23 13:15 ` [Bug c++/64079] %+D in diagnostics breaks pragma GCC diagnostic manu at gcc dot gnu.org
2015-07-23 20:25 ` jason at gcc dot gnu.org
2015-07-24  9:06 ` paolo.carlini at oracle dot com
2015-07-24 12:46 ` manu at gcc dot gnu.org
2015-07-24 20:20 ` paolo at gcc dot gnu.org
2015-07-24 22:57 ` manu at gcc dot gnu.org
2015-07-25  6:38 ` woodroof at gmail dot com

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).