public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/52578] New: Fails to fold another size difference Date: Tue, 13 Mar 2012 16:42:00 -0000 [thread overview] Message-ID: <bug-52578-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52578 Bug #: 52578 Summary: Fails to fold another size difference Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned@gcc.gnu.org ReportedBy: rguenth@gcc.gnu.org gnat.dg/opt9.adb will fail with the bitfield handling patch with -m32 because we do not fold long bar (long i) { return (long)((unsigned long)i + 2) - (long)i; } long foo (int i) { return (long)((unsigned long)i + 2) - (long)i; } to constants. the associate: path splits the above to var0 == (long unsigned int) i, lit0 == 2, var1 == -i which fails to associate because of /* With undefined overflow we can only associate constants with one variable, and constants whose association doesn't overflow. */ if ((POINTER_TYPE_P (type) && POINTER_TYPE_OVERFLOW_UNDEFINED) || (INTEGRAL_TYPE_P (type) && !TYPE_OVERFLOW_WRAPS (type))) { if (var0 && var1) { tree tmp0 = var0; tree tmp1 = var1; if (TREE_CODE (tmp0) == NEGATE_EXPR) tmp0 = TREE_OPERAND (tmp0, 0); if (TREE_CODE (tmp1) == NEGATE_EXPR) tmp1 = TREE_OPERAND (tmp1, 0); /* The only case we can still associate with two variables is if they are the same, modulo negation. */ if (!operand_equal_p (tmp0, tmp1, 0)) ok = false; but we can as well strip widening and sign-changing conversions I think.
next reply other threads:[~2012-03-13 16:42 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-03-13 16:42 rguenth at gcc dot gnu.org [this message] 2012-03-13 17:01 ` [Bug middle-end/52578] " rguenth at gcc dot gnu.org 2012-03-14 10:52 ` rguenth at gcc dot gnu.org 2012-03-14 11:12 ` rguenth 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-52578-4@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).