public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/41186] New: VN doesn't look through non-aliasing by offset memcpy Date: Sat, 29 Aug 2009 12:43:00 -0000 [thread overview] Message-ID: <bug-41186-10053@http.gcc.gnu.org/bugzilla/> (raw) The C++ FE now creates memcpy for class copies to avoid copying objects in tail-padding. struct Foo { Foo() {}; int i; short f; }; struct Bar : public Foo { Bar() {}; short b; }; extern "C" void abort(void); int main() { Bar b1, b2; b2.i = 0; b1.f = 0; b1.b = 1; b2.f = 1; b2.b = 2; static_cast<Foo&>(b1) = static_cast<Foo&>(b2); if (b1.i != 0 || b1.b != 1) abort (); if (b1.f != 1) abort (); return 0; } The alias-oracle does consider the memcpy to clobber b1.b and the look-through doesn't find b1.f or b1.i either. Note that with combining the tests like if (b1.i != 0 || b1.b != 1 || b1.f != 1) abort (); fold creates a BIT_FIELD_REF covering both b and f which confuses us even more. But I have considered this a bad habit of fold earlier. -- Summary: VN doesn't look through non-aliasing by offset memcpy Product: gcc Version: 4.5.0 Status: UNCONFIRMED Keywords: missed-optimization, alias Severity: enhancement Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rguenth at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41186
next reply other threads:[~2009-08-29 12:43 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-08-29 12:43 rguenth at gcc dot gnu dot org [this message] 2009-08-29 13:49 ` [Bug tree-optimization/41186] " rguenth at gcc dot gnu dot org 2009-08-30 11:52 ` rguenth at gcc dot gnu dot org 2009-09-26 15:28 ` rguenth at gcc dot gnu dot 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-41186-10053@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).