public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/66452] New: [6 Regression] [UBSAN] *.Lubsan_data0' defined but not used
@ 2015-06-07 20:13 dimhen at gmail dot com
  2015-06-08  8:18 ` [Bug sanitizer/66452] " mpolacek at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: dimhen at gmail dot com @ 2015-06-07 20:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66452
           Summary: [6 Regression] [UBSAN] *.Lubsan_data0' defined but not
                    used
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dimhen at gmail dot com
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org
  Target Milestone: ---

r224060 PASS
r224193 FAIL

$ g++ -Wall -O0 -fsanitize=undefined -c x.ii -fpreprocessed -o x.o
x.ii: In member function 'A B::m_fn1() const':
x.ii:9:12: warning: unused variable 'i' [-Wunused-variable]
   for (int i;;)
            ^
At global scope:
cc1plus: warning: '*.Lubsan_data0' defined but not used [-Wunused-variable]

$ cat x.ii
class A {
public:
  A(int);
};
class B {
  A m_fn1() const;
};
A B::m_fn1() const {
  for (int i;;)
    ;
  return 0;
}

$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/local/gcc_current/libexec/gcc/x86_64-unknown-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/dimhen/src/gcc_current/configure
--prefix=/usr/local/gcc_current --enable-static
--enable-checking=yes,df,fold,rtl --enable-languages=c,c++,lto --enable-plugin
--disable-libstdcxx-dual-abi --disable-multilib
Thread model: posix
gcc version 6.0.0 20150606 (experimental) [trunk revision 224193] (GCC)

$ ~/bin/gcc_224060_rls/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/home/dimhen/bin/gcc_224060_rls/bin/g++
COLLECT_LTO_WRAPPER=/home/dimhen/bin/gcc_224060_rls/bin/../libexec/gcc/x86_64-unknown-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/dimhen/src/gcc_r224060/configure
--prefix=/usr/local/gcc_current --enable-static --enable-checking=release
--enable-languages=c,c++,lto --enable-plugin --disable-libstdcxx-dual-abi
--disable-multilib
Thread model: posix
gcc version 6.0.0 20150603 (experimental) [trunk revision 224060] (GCC)


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

* [Bug sanitizer/66452] [6 Regression] [UBSAN] *.Lubsan_data0' defined but not used
  2015-06-07 20:13 [Bug sanitizer/66452] New: [6 Regression] [UBSAN] *.Lubsan_data0' defined but not used dimhen at gmail dot com
@ 2015-06-08  8:18 ` mpolacek at gcc dot gnu.org
  2015-06-08  8:34 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-06-08  8:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-06-08
                 CC|                            |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |6.0
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.


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

* [Bug sanitizer/66452] [6 Regression] [UBSAN] *.Lubsan_data0' defined but not used
  2015-06-07 20:13 [Bug sanitizer/66452] New: [6 Regression] [UBSAN] *.Lubsan_data0' defined but not used dimhen at gmail dot com
  2015-06-08  8:18 ` [Bug sanitizer/66452] " mpolacek at gcc dot gnu.org
@ 2015-06-08  8:34 ` mpolacek at gcc dot gnu.org
  2015-06-08  8:36 ` dimhen at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-06-08  8:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r224161 aka debug-early branch merge.


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

* [Bug sanitizer/66452] [6 Regression] [UBSAN] *.Lubsan_data0' defined but not used
  2015-06-07 20:13 [Bug sanitizer/66452] New: [6 Regression] [UBSAN] *.Lubsan_data0' defined but not used dimhen at gmail dot com
  2015-06-08  8:18 ` [Bug sanitizer/66452] " mpolacek at gcc dot gnu.org
  2015-06-08  8:34 ` mpolacek at gcc dot gnu.org
@ 2015-06-08  8:36 ` dimhen at gmail dot com
  2015-06-08  8:45 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dimhen at gmail dot com @ 2015-06-08  8:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Dmitry G. Dyachenko <dimhen at gmail dot com> ---
r224136 PASS
r224161 FAIL (stage1 compiler due broken bootstrap)


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

* [Bug sanitizer/66452] [6 Regression] [UBSAN] *.Lubsan_data0' defined but not used
  2015-06-07 20:13 [Bug sanitizer/66452] New: [6 Regression] [UBSAN] *.Lubsan_data0' defined but not used dimhen at gmail dot com
                   ` (2 preceding siblings ...)
  2015-06-08  8:36 ` dimhen at gmail dot com
@ 2015-06-08  8:45 ` mpolacek at gcc dot gnu.org
  2015-06-08 10:36 ` mpolacek at gcc dot gnu.org
  2015-06-08 10:36 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-06-08  8:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I'm testing

--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -534,6 +534,7 @@ check_global_declaration (tree decl)
         to handle multiple external decls in different scopes.  */
       && ! (DECL_NAME (decl) && TREE_USED (DECL_NAME (decl)))
       && ! DECL_EXTERNAL (decl)
+      && ! DECL_ARTIFICIAL (decl)
       && ! TREE_PUBLIC (decl)
       /* A volatile variable might be used in some non-obvious way.  */
       && ! TREE_THIS_VOLATILE (decl)

(Maybe we should also test !TREE_NO_WARNING but the above is enough to fix
this.)


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

* [Bug sanitizer/66452] [6 Regression] [UBSAN] *.Lubsan_data0' defined but not used
  2015-06-07 20:13 [Bug sanitizer/66452] New: [6 Regression] [UBSAN] *.Lubsan_data0' defined but not used dimhen at gmail dot com
                   ` (3 preceding siblings ...)
  2015-06-08  8:45 ` mpolacek at gcc dot gnu.org
@ 2015-06-08 10:36 ` mpolacek at gcc dot gnu.org
  2015-06-08 10:36 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-06-08 10:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Mon Jun  8 10:35:24 2015
New Revision: 224216

URL: https://gcc.gnu.org/viewcvs?rev=224216&root=gcc&view=rev
Log:
        PR sanitizer/66452
        * toplev.c (check_global_declaration): Don't warn about artificial
        decls.

        * g++.dg/ubsan/pr66452.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/ubsan/pr66452.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/toplev.c


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

* [Bug sanitizer/66452] [6 Regression] [UBSAN] *.Lubsan_data0' defined but not used
  2015-06-07 20:13 [Bug sanitizer/66452] New: [6 Regression] [UBSAN] *.Lubsan_data0' defined but not used dimhen at gmail dot com
                   ` (4 preceding siblings ...)
  2015-06-08 10:36 ` mpolacek at gcc dot gnu.org
@ 2015-06-08 10:36 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-06-08 10:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.


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

end of thread, other threads:[~2015-06-08 10:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-07 20:13 [Bug sanitizer/66452] New: [6 Regression] [UBSAN] *.Lubsan_data0' defined but not used dimhen at gmail dot com
2015-06-08  8:18 ` [Bug sanitizer/66452] " mpolacek at gcc dot gnu.org
2015-06-08  8:34 ` mpolacek at gcc dot gnu.org
2015-06-08  8:36 ` dimhen at gmail dot com
2015-06-08  8:45 ` mpolacek at gcc dot gnu.org
2015-06-08 10:36 ` mpolacek at gcc dot gnu.org
2015-06-08 10:36 ` 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).