[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #21 from pluto at agmk dot net 2009-02-27 10:29 --- (In reply to comment #20) Same issue. Only possible fix is to not apply TBAA pruning to escaped symbols, which will - well - basically disable TBAA. Testcase: waht about this testcase? the bug is marked as fixed but warnings are still present? inline void *operator new (__SIZE_TYPE__, void *__p) throw() { return __p; } struct Y { Y() {} int i; }; struct X { X() {} void construct(const Y y) { new (m_data[0]) Y(y); } template class T Y get() { return reinterpret_castY(m_data); } bool initialized; char m_data[sizeof (Y)]; }; X x; void bar(const X); void foo(Y y) { x.getY() = y; x.initialized = true; bar(x); } t.cpp: In member function 'Y X::get() [with T = Y]': t.cpp:25: instantiated from here t.cpp:15: warning: dereferencing type-punned pointer will break strict-aliasing rules t.cpp: In function 'void foo(Y)': t.cpp:25: warning: dereferencing pointer 'anonymous' does break strict-aliasing rules t.cpp:25: note: initialized from here -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #22 from rguenther at suse dot de 2009-02-27 10:33 --- Subject: Re: [4.4 regression] warnings from -isystem headers strikes back. On Fri, 27 Feb 2009, pluto at agmk dot net wrote: --- Comment #21 from pluto at agmk dot net 2009-02-27 10:29 --- (In reply to comment #20) Same issue. Only possible fix is to not apply TBAA pruning to escaped symbols, which will - well - basically disable TBAA. Testcase: waht about this testcase? the bug is marked as fixed but warnings are still present? The original reported problem is gone. The testcase below is unfixable. inline void *operator new (__SIZE_TYPE__, void *__p) throw() { return __p; } struct Y { Y() {} int i; }; struct X { X() {} void construct(const Y y) { new (m_data[0]) Y(y); } template class T Y get() { return reinterpret_castY(m_data); } bool initialized; char m_data[sizeof (Y)]; }; X x; void bar(const X); void foo(Y y) { x.getY() = y; x.initialized = true; bar(x); } t.cpp: In member function 'Y X::get() [with T = Y]': t.cpp:25: instantiated from here t.cpp:15: warning: dereferencing type-punned pointer will break strict-aliasing rules t.cpp: In function 'void foo(Y)': t.cpp:25: warning: dereferencing pointer 'anonymous' does break strict-aliasing rules t.cpp:25: note: initialized from here -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #23 from pluto at agmk dot net 2009-02-27 11:04 --- (In reply to comment #22) The original reported problem is gone. The testcase below is unfixable. so what users can do now? the -isystem feature doesn't work as expected with this unfixable diagnostics. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #24 from rguenth at gcc dot gnu dot org 2009-02-27 11:07 --- The user can use -Wno-strict-aliasing. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #25 from pluto at agmk dot net 2009-02-27 11:22 --- (In reply to comment #24) The user can use -Wno-strict-aliasing. naturally, but -O2 turns on -fstrict-aliasing, so using strict-aliasing without warnings about aliasing violations is a bit horrible :) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #26 from rguenther at suse dot de 2009-02-27 12:04 --- Subject: Re: [4.4 regression] warnings from -isystem headers strikes back. On Fri, 27 Feb 2009, pluto at agmk dot net wrote: --- Comment #25 from pluto at agmk dot net 2009-02-27 11:22 --- (In reply to comment #24) The user can use -Wno-strict-aliasing. naturally, but -O2 turns on -fstrict-aliasing, so using strict-aliasing without warnings about aliasing violations is a bit horrible :) On IRC we agreed that turning strict-aliasing warnings off for system-headers is not a good idea. So -Wno-strict-aliasing is the only thing I can offer. Richard. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #19 from pluto at agmk dot net 2009-02-02 08:55 --- (In reply to comment #16) Subject: Bug 38503 Author: rguenth Date: Tue Jan 27 10:42:59 2009 New Revision: 143700 this patch doesn't fix testcase that i found yesterday. i found another testcase for gcc-4.4.0-20090130 not covered by patch commited on january, the 27. $ cat bug2.cpp #include boost/optional.hpp #include string struct X { std::string s; bool f; }; extern boost::optional X x; void foo( std::string const ); bool bar() { if ( !x ) return false; if ( x-f ) foo( x-s ); return false; } $ make rm -f *.ii *.o *.s /local/devel/toolchain44/x86_64-gnu-linux/bin/x86_64-gnu-linux-g++ -c -Wall -O2 -g0 -fPIC --save-temps -isystem ./sys-headers bug2.cpp bug2.cpp: In function 'bool bar()': bug2.cpp:14: warning: dereferencing pointer 'anonymous' does break strict-aliasing rules bug2.cpp:14: note: initialized from here -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #20 from rguenth at gcc dot gnu dot org 2009-02-02 10:23 --- Same issue. Only possible fix is to not apply TBAA pruning to escaped symbols, which will - well - basically disable TBAA. Testcase: inline void *operator new (__SIZE_TYPE__, void *__p) throw() { return __p; } struct Y { Y() {} int i; }; struct X { X() {} void construct(const Y y) { new (m_data[0]) Y(y); } template class T Y get() { return reinterpret_castY(m_data); } bool initialized; char m_data[sizeof (Y)]; }; X x; void bar(const X); void foo(Y y) { x.getY() = y; x.initialized = true; bar(x); } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #18 from hjl at gcc dot gnu dot org 2009-01-30 17:32 --- Subject: Bug 38503 Author: hjl Date: Fri Jan 30 17:31:24 2009 New Revision: 143798 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=143798 Log: 2009-01-30 H.J. Lu hongjiu...@intel.com 2009-01-27 Richard Guenther rguent...@suse.de PR tree-optimization/38503 * g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C: New testcase. 2009-01-26 Richard Guenther rguent...@suse.de PR tree-optimization/38745 * g++.dg/torture/pr38745.C: New testcase. 2009-01-26 Richard Guenther rguent...@suse.de PR middle-end/38851 * g++.dg/warn/Wuninitialized-1.C: New testcase. 2009-01-20 Andrew Pinski andrew_pin...@playstation.sony.com Richard Guenther rguent...@suse.de PR tree-optimization/38747 PR tree-optimization/38748 * gcc.dg/tree-ssa/struct-aliasing-1.c: New test. * gcc.c-torture/execute/struct-aliasing-1.c: Likewise. Added: branches/gcc-4_3-branch/gcc/testsuite/g++.dg/torture/pr38745.C - copied unchanged from r143797, trunk/gcc/testsuite/g++.dg/torture/pr38745.C branches/gcc-4_3-branch/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C - copied unchanged from r143797, trunk/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C branches/gcc-4_3-branch/gcc/testsuite/g++.dg/warn/Wuninitialized-1.C - copied unchanged from r143797, trunk/gcc/testsuite/g++.dg/warn/Wuninitialized-1.C branches/gcc-4_3-branch/gcc/testsuite/gcc.c-torture/execute/struct-aliasing-1.c - copied unchanged from r143797, trunk/gcc/testsuite/gcc.c-torture/execute/struct-aliasing-1.c branches/gcc-4_3-branch/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c - copied unchanged from r143797, trunk/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c Modified: branches/gcc-4_3-branch/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #16 from rguenth at gcc dot gnu dot org 2009-01-27 10:43 --- Subject: Bug 38503 Author: rguenth Date: Tue Jan 27 10:42:59 2009 New Revision: 143700 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=143700 Log: 2009-01-27 Richard Guenther rguent...@suse.de PR tree-optimization/38503 * cfgexpand.c (expand_gimple_basic_block): Ignore GIMPLE_CHANGE_DYNAMIC_TYPE during expansion. * tree-ssa-structalias.c (set_uids_in_ptset): Do not prune variables that cannot have TBAA applied. (compute_points_to_sets): Do not remove GIMPLE_CHANGE_DYNAMIC_TYPE statements. * g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C Modified: trunk/gcc/ChangeLog trunk/gcc/cfgexpand.c trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-ssa-structalias.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #17 from rguenth at gcc dot gnu dot org 2009-01-27 10:43 --- Fixed. -- rguenth at gcc dot gnu dot org changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #13 from rguenth at gcc dot gnu dot org 2009-01-24 15:56 --- Testcase: inline void *operator new (__SIZE_TYPE__, void *__p) throw() { return __p; } struct Y { Y() {} int i; }; struct X { X() {} void construct(const Y y) { new (m_data[0]) Y(y); } bool initialized; char m_data[sizeof (Y)]; }; void bar(const X); void foo(Y y) { X x; x.construct(y); x.initialized = true; bar(x); } -- rguenth at gcc dot gnu dot org changed: What|Removed |Added Status|WAITING |NEW Last reconfirmed|2009-01-05 11:24:29 |2009-01-24 15:56:04 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #14 from rguenth at gcc dot gnu dot org 2009-01-24 17:00 --- placement new handling is still completely broken. And of course unfixable without severely pessimizing TBAA. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #15 from rguenth at gcc dot gnu dot org 2009-01-24 17:50 --- Mine. -- rguenth at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED Last reconfirmed|2009-01-24 15:56:04 |2009-01-24 17:50:17 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
-- rguenth at gcc dot gnu dot org changed: What|Removed |Added Keywords||wrong-code Priority|P2 |P1 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #12 from rguenth at gcc dot gnu dot org 2009-01-23 16:52 --- this is placement-new related. D.20941_8 = ox ox = { } no-tbaa-pruning D.20941_8 = { ox } alias warning for D.20941_8 After alias: ox.D.20531.m_initialized = 0; D.20941_8 = (struct X *) ox.D.20531.m_storage.dummy_.data[0]; D.20941_8-e_ = 0; ox.D.20531.m_initialized = 1; D.20946_10 = ox.D.20531.m_initialized; Before: ox.D.20531.m_initialized ={v} 0; change_dynamic_type (struct X *) ox.D.20531.m_storage.dummy_.data[0]) D.20941_8 = (struct X *) ox.D.20531.m_storage.dummy_.data[0]; D.20941_8-e_ ={v} 0; ox.D.20531.m_initialized ={v} 1; D.20946_10 = ox.D.20531.m_initialized; so it looks like we do placement new on _parts_ of an object that continues to live over that placement new. Uh oh. Is this even legal? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #9 from rguenth at gcc dot gnu dot org 2009-01-14 16:48 --- I just installed a fix - can you verify if all the annoying warnigns are gone? Thx! -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #10 from pluto at agmk dot net 2009-01-14 18:29 --- (In reply to comment #9) I just installed a fix - can you verify if all the annoying warnigns are gone? Thx! they are still there. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #11 from rguenther at suse dot de 2009-01-14 20:50 --- Subject: Re: [4.4 regression] warnings from -isystem headers strikes back. On Wed, 14 Jan 2009, pluto at agmk dot net wrote: --- Comment #10 from pluto at agmk dot net 2009-01-14 18:29 --- (In reply to comment #9) I just installed a fix - can you verify if all the annoying warnigns are gone? Thx! they are still there. Then they are either real bugs in the testcase or in PTA. Richard. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #5 from rguenth at gcc dot gnu dot org 2009-01-12 13:54 --- I can't seem to compile the preprocessed source: In file included from ./sys-headers/boost/mpl/int.hpp:21, from ./sys-headers/boost/type_traits/detail/template_arity_spec .hpp:11, from ./sys-headers/boost/type_traits/detail/bool_trait_def.hpp: 15, from ./sys-headers/boost/type_traits/is_same.hpp:32, from ./sys-headers/boost/type_traits/intrinsics.hpp:131, from ./sys-headers/boost/type_traits/alignment_of.hpp:16, from ./sys-headers/boost/optional/optional.hpp:22, from ./sys-headers/boost/optional.hpp:16, from bug.cpp:2: ./sys-headers/boost/mpl/aux_/integral_wrapper.hpp:43: error: expected unqualifie d-id before int ./sys-headers/boost/mpl/aux_/integral_wrapper.hpp:43: error: expected ) before int ... Note that the warning is from bug.cpp:6, not a system header anyway (the _note_ is from a system header, do you want that to disappear?) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #6 from pluto at agmk dot net 2009-01-12 15:01 --- Created an attachment (id=17077) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17077action=view) full testcase (src + .ii + mkefile) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #7 from pluto at agmk dot net 2009-01-12 15:10 --- (In reply to comment #5) I can't seem to compile the preprocessed source: i've attached a new full archive. $ make rm -f *.ii *.o *.s /local/devel/toolchain44/x86_64-gnu-linux/bin/x86_64-gnu-linux-g++ -c -Wall -O2 -g0 -fPIC --save-temps -isystem ./sys-headers bug.cpp bug.cpp: In function 'void foo()': bug.cpp:6: warning: dereferencing pointer 'anonymous' does break strict-aliasing rules ./sys-headers/boost/optional/optional.hpp:315: note: initialized from here bug.cpp:6: warning: dereferencing pointer 'anonymous' does break strict-aliasing rules ./sys-headers/boost/optional/optional.hpp:594: note: initialized from here Note that the warning is from bug.cpp:6, not a system header anyway looks weird, because i can't see any dereferencing in bug.cpp:6 there's only trivial cctor which copies an enum. for me it looks like the warning comes from boost::optional:: ::aligned_storage::adress() manipulations inside boost system headers. (the _note_ is from a system header, do you want that to disappear?) i want to disappear'em all :-) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #8 from rguenther at suse dot de 2009-01-12 15:16 --- Subject: Re: [4.4 regression] warnings from -isystem headers strikes back. On Mon, 12 Jan 2009, pluto at agmk dot net wrote: --- Comment #7 from pluto at agmk dot net 2009-01-12 15:10 --- (In reply to comment #5) I can't seem to compile the preprocessed source: i've attached a new full archive. $ make rm -f *.ii *.o *.s /local/devel/toolchain44/x86_64-gnu-linux/bin/x86_64-gnu-linux-g++ -c -Wall -O2 -g0 -fPIC --save-temps -isystem ./sys-headers bug.cpp bug.cpp: In function 'void foo()': bug.cpp:6: warning: dereferencing pointer 'anonymous' does break strict-aliasing rules ./sys-headers/boost/optional/optional.hpp:315: note: initialized from here bug.cpp:6: warning: dereferencing pointer 'anonymous' does break strict-aliasing rules ./sys-headers/boost/optional/optional.hpp:594: note: initialized from here Note that the warning is from bug.cpp:6, not a system header anyway looks weird, because i can't see any dereferencing in bug.cpp:6 there's only trivial cctor which copies an enum. for me it looks like the warning comes from boost::optional:: ::aligned_storage::adress() manipulations inside boost system headers. (the _note_ is from a system header, do you want that to disappear?) i want to disappear'em all :-) Fair enough ;) The compiler just warns that in a second it will remove that dereference (ok, only on the alias-improvements branch). Richard. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #3 from jakub at gcc dot gnu dot org 2009-01-09 10:25 --- Please preprocess the testcase. Whether a header was a system header or not is recorded in # linenum directives in the preprocessed output. -- jakub at gcc dot gnu dot org changed: What|Removed |Added Status|NEW |WAITING http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #4 from pluto at agmk dot net 2009-01-09 19:52 --- Created an attachment (id=17067) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17067action=view) preprocessed testcase. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
-- rguenth at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords||diagnostic Priority|P3 |P2 Last reconfirmed|-00-00 00:00:00 |2009-01-05 11:24:29 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
-- pinskia at gcc dot gnu dot org changed: What|Removed |Added Target Milestone|--- |4.4.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #1 from pluto at agmk dot net 2008-12-12 11:37 --- Created an attachment (id=16897) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16897action=view) testcase. to reproduce bug you also need the boost-1.37.0 headers. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503
[Bug middle-end/38503] [4.4 regression] warnings from -isystem headers strikes back.
--- Comment #2 from rguenth at gcc dot gnu dot org 2008-12-12 11:53 --- Related to/dup of PR38477. I'll leave this one for the system header issue and PR38477 for the libstdc++/C++ alias problem. -- rguenth at gcc dot gnu dot org changed: What|Removed |Added CC||rguenth at gcc dot gnu dot ||org OtherBugsDependingO||38477 nThis|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503