public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hubicka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/67056] [5/6 regression] Wrong code generated Date: Fri, 16 Oct 2015 04:45:00 -0000 [thread overview] Message-ID: <bug-67056-4-YDnxbdTy6F@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-67056-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67056 --- Comment #14 from Jan Hubicka <hubicka at gcc dot gnu.org> --- OK, the unreachable is introduced here: - Creating a specialized node of bool staticBoolFunc(CompositeClass*)/414 for all known contexts. the new node is <built-in>/977. known ctx 0 is Outer type (dynamic):struct EmptyClass offset -64 No devirtualization target in <built-in>/977 ipa-prop: Discovered a virtual call to a known target (<built-in>/977 -> void __builtin_unreachable()/976), for stmt OBJ_TYPE_REF(_15;ptr_2(D)->1) (ptr_2(D)); /aux/hubicka/trunk-install/include/c++/6.0.0/bits/unique_ptr.h:76:2: note: converting indirect call in <built-in> to direct call to void __builtin_unreachable() No devirtualization target in <built-in>/977 ipa-prop: Discovered a virtual call to a known target (<built-in>/977 -> void __builtin_unreachable()/976), for stmt OBJ_TYPE_REF(_27;ptr_2(D)->1) (ptr_2(D)); /aux/hubicka/trunk-install/include/c++/6.0.0/bits/unique_ptr.h:76:2: note: converting indirect call in <built-in> to direct call to void __builtin_unreachable() So ipa-CP thinks that staticBoolFunc is called on EmptyClass instead of CompositeClass: Jump functions: Jump functions of caller long unsigned int __builtin_object_size(const void*, int)/967: Jump functions of caller void operator delete(void*, long unsigned int)/964: Jump functions of caller void* operator new(std::size_t)/963: Jump functions of caller int main(int, char**)/415: callsite int main(int, char**)/415 -> void operator delete(void*, long unsigned int)/964 : callsite int main(int, char**)/415 -> bool staticBoolFunc(CompositeClass*)/414 : param 0: UNKNOWN Context: Outer type (dynamic):struct EmptyClass offset -64 Unknown alignment callsite int main(int, char**)/415 -> EmptyClass::EmptyClass()/404 : param 0: UNKNOWN Context: Outer type (dynamic): (or a derived type) (maybe in construction) offset 64 Speculative outer type:struct CompositeClass (or a derived type) at offset 64 Unknown alignment This is indeed wrong. Jump function analysis seems to confuse constructors: Modification phase of node int main(int, char**)/402 int main(int, char**) (int D.39529, char * * D.39530) { void * _3; struct EmptyClass * _7; <bb 2>: _3 = operator new (16); MEM[(struct &)_3] ={v} {CLOBBER}; MEM[(struct CompositeClass *)_3]._vptr.CompositeClass = &MEM[(void *)&_ZTV14CompositeClass + 16B]; _7 = &MEM[(struct CompositeClass *)_3].object; EmptyClass::EmptyClass (_7); <bb 3>: staticBoolFunc (_3); return 0; <L1>: operator delete (_3, 16); resx 1 EmptyClass ctor is called, but it should not type the object. Determining dynamic type for call: staticBoolFunc (_3); Starting walk at: staticBoolFunc (_3); instance pointer: _3 Outer instance pointer: _3 offset: 0 (bits) vtbl reference: Checking constructor call: EmptyClass::EmptyClass (_7); Recording type: struct EmptyClass at offset -64 Determined dynamic type. This is quite a nonsense, because EmptyClass is not even. So there are two bugs. First is that we determine useless outer type. This should be just missed optimization. But we also manage to consider to miss the case in placement_new checking where we are completely off the structure....
next prev parent reply other threads:[~2015-10-16 4:45 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-07-29 14:24 [Bug c++/67056] New: " balder@yahoo-inc.com 2015-07-29 14:26 ` [Bug c++/67056] " ktkachov at gcc dot gnu.org 2015-07-29 14:53 ` trippels at gcc dot gnu.org 2015-07-29 14:59 ` balder@yahoo-inc.com 2015-07-29 15:39 ` balder@yahoo-inc.com 2015-08-04 13:06 ` vegard@yahoo-inc.com 2015-08-04 13:09 ` vegard@yahoo-inc.com 2015-08-04 14:43 ` trippels at gcc dot gnu.org 2015-08-04 14:45 ` [Bug ipa/67056] [5/6 regression] " trippels at gcc dot gnu.org 2015-08-04 15:47 ` trippels at gcc dot gnu.org 2015-08-05 7:30 ` balder@yahoo-inc.com 2015-08-05 8:07 ` trippels at gcc dot gnu.org 2015-08-05 10:02 ` trippels at gcc dot gnu.org 2015-10-12 8:13 ` hubicka at gcc dot gnu.org 2015-10-16 4:45 ` hubicka at gcc dot gnu.org [this message] 2015-10-16 4:46 ` hubicka at gcc dot gnu.org 2015-10-16 6:25 ` hubicka at gcc dot gnu.org 2015-10-16 8:28 ` rguenth at gcc dot gnu.org 2015-10-21 21:14 ` hubicka at gcc dot gnu.org 2015-10-22 3:19 ` [Bug ipa/67056] [5 " hubicka at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-67056-4-YDnxbdTy6F@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).