public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Andrew Pinski <pinskia@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-5071] [Committed] Fix tree-optimization/103152: Still one more -signed1bit issue Date: Tue, 9 Nov 2021 19:03:56 +0000 (GMT) [thread overview] Message-ID: <20211109190356.1985D385B805@sourceware.org> (raw) https://gcc.gnu.org/g:f7844b6a777cb47fec7208d7bd594f6ce66f1daa commit r12-5071-gf7844b6a777cb47fec7208d7bd594f6ce66f1daa Author: Andrew Pinski <apinski@marvell.com> Date: Tue Nov 9 09:56:10 2021 +0000 [Committed] Fix tree-optimization/103152: Still one more -signed1bit issue When I fixed PR 102622, I accidently left behind a TYPE_PRECISION check which I had there for checking before hand. This check is not needed as the code will handle it correctly anyways. Committed as obvious after a bootstrap/test on x86_64-linux-gnu. PR tree-optimization/10352 gcc/ChangeLog: * match.pd: Remove check of TYPE_PRECISION for the a?0:pow2 case. gcc/testsuite/ChangeLog: * gcc.c-torture/execute/pr10352-1.c: New test. Diff: --- gcc/match.pd | 3 +-- gcc/testsuite/gcc.c-torture/execute/pr10352-1.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gcc/match.pd b/gcc/match.pd index cdab5e59f4e..986b052bc93 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -4056,8 +4056,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (if (integer_onep (@2)) (convert (bit_xor (convert:boolean_type_node @0) { booltrue; } ))) /* a ? powerof2cst : 0 -> (!a) << (log2(powerof2cst)) */ - (if (INTEGRAL_TYPE_P (type) && integer_pow2p (@2) - && TYPE_PRECISION (type) != 1) + (if (INTEGRAL_TYPE_P (type) && integer_pow2p (@2)) (with { tree shift = build_int_cst (integer_type_node, tree_log2 (@2)); } diff --git a/gcc/testsuite/gcc.c-torture/execute/pr10352-1.c b/gcc/testsuite/gcc.c-torture/execute/pr10352-1.c new file mode 100644 index 00000000000..babb9d45a28 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr10352-1.c @@ -0,0 +1,12 @@ +/* this is another case where phiopt + would create -signed1bit which is undefined. */ +struct { + int a:1; +} b; +int *c = (int *)&b, d; +int main() { + d = c && (b.a = (d < 0) ^ 3); + if (d != 1) + __builtin_abort(); + return 0; +}
reply other threads:[~2021-11-09 19:03 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20211109190356.1985D385B805@sourceware.org \ --to=pinskia@gcc.gnu.org \ --cc=gcc-cvs@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).