public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108517] [11/12/13 Regression] std::sort of empty range yield "warning: 'this' pointer is null" Date: Wed, 01 Feb 2023 12:32:40 +0000 [thread overview] Message-ID: <bug-108517-4-yM0JCaCPSs@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-108517-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108517 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |jamborm at gcc dot gnu.org --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I guess usual problem with late warnings. In this particular case, we have std::__insertion_sort called with __first, __first+16 and IPA-CP decides to create a constprop version for it with the first argument 0B but the second one passed: Evaluating opportunities for void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = object*; _Compare = __gnu_cxx::__ops::_I ter_comp_iter<main()::<lambda(const auto:1&, const auto:2&)> >]/108. - Creating a specialized node of void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = object*; _Compare = __gnu_cxx::__op s::_Iter_comp_iter<main()::<lambda(const auto:1&, const auto:2&)> >]/108 for all known contexts. replacing param #0 __first with const 0B Accounting size:6.00, time:38.09 on predicate exec:(true) Accounting size:3.00, time:2.00 on new predicate exec:(not inlined) Accounting size:2.00, time:2.00 on new predicate exec:(true) nonconst:(op1 changed) Accounting size:3.00, time:79.53 on predicate exec:(true) Accounting size:3.00, time:79.53 on predicate exec:(true) Accounting size:4.00, time:43.08 on predicate exec:(true) Accounting size:3.00, time:39.76 on predicate exec:(true) the new node is __insertion_sort.constprop/202. and in that case it indeed calls object::size with NULL this in that function. Somehow this constprop function is kept in the IL but not really called by anything once IPA passes are done. Ideally a fix for this particular case would be not to keep clearly dead function in the IL, but not familiar enough with reading IPA dumps to see where the caller actually went away. Or perhaps when making constprop for __first_5(D) being 0B when the second argument is _2 = __first_5(D) + 16 also constprop it for the second one being 16B, then I think cfg cleanup could just optimize it away. Or both.
next prev parent reply other threads:[~2023-02-01 12:32 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-24 12:01 [Bug libstdc++/108517] New: " hanicka at hanicka dot net 2023-01-24 12:33 ` [Bug libstdc++/108517] " redi at gcc dot gnu.org 2023-01-24 12:35 ` redi at gcc dot gnu.org 2023-01-24 12:37 ` [Bug c++/108517] " redi at gcc dot gnu.org 2023-01-24 12:41 ` redi at gcc dot gnu.org 2023-01-24 13:01 ` [Bug c++/108517] [11/12/13 Regression] " redi at gcc dot gnu.org 2023-01-24 13:07 ` rguenth at gcc dot gnu.org 2023-02-01 12:32 ` jakub at gcc dot gnu.org [this message] 2023-02-01 12:40 ` jakub at gcc dot gnu.org 2023-02-15 15:28 ` jamborm at gcc dot gnu.org 2023-02-21 12:59 ` rguenth at gcc dot gnu.org 2023-05-29 10:07 ` [Bug c++/108517] [11/12/13/14 " jakub 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-108517-4-yM0JCaCPSs@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).