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)