public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r10-10768] middle-end/105140 - fix bogus recursion in fold_convertible_p Date: Fri, 27 May 2022 13:15:38 +0000 (GMT) [thread overview] Message-ID: <20220527131538.1DD02395B422@sourceware.org> (raw) https://gcc.gnu.org/g:c515adf5d339ad942207d9121cf49e5b6c84093e commit r10-10768-gc515adf5d339ad942207d9121cf49e5b6c84093e Author: Richard Biener <rguenther@suse.de> Date: Mon Apr 4 10:20:05 2022 +0200 middle-end/105140 - fix bogus recursion in fold_convertible_p fold_convertible_p expects an operand and a type to convert to but recurses with two vector component types. Fixed by allowing types instead of an operand as well. 2022-04-04 Richard Biener <rguenther@suse.de> PR middle-end/105140 * fold-const.c (fold_convertible_p): Allow a TYPE_P arg. * gcc.dg/pr105140.c: New testcase. (cherry picked from commit eaaf77dd85c333b116111bb1ae6c080154a4e411) Diff: --- gcc/fold-const.c | 5 +++-- gcc/testsuite/gcc.dg/pr105140.c | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 94f92e63893..665ed82b590 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -2356,12 +2356,13 @@ build_zero_vector (tree type) return build_vector_from_val (type, t); } -/* Returns true, if ARG is convertible to TYPE using a NOP_EXPR. */ +/* Returns true, if ARG, an operand or a type, is convertible to TYPE + using a NOP_EXPR. */ bool fold_convertible_p (const_tree type, const_tree arg) { - tree orig = TREE_TYPE (arg); + const_tree orig = TYPE_P (arg) ? arg : TREE_TYPE (arg); if (type == orig) return true; diff --git a/gcc/testsuite/gcc.dg/pr105140.c b/gcc/testsuite/gcc.dg/pr105140.c new file mode 100644 index 00000000000..14bff2f7f9c --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr105140.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-Os -w -Wno-psabi" } */ + +typedef char __attribute__((__vector_size__ (16 * sizeof (char)))) U; +typedef int __attribute__((__vector_size__ (16 * sizeof (int)))) V; + +void bar (); + +bar (int i, int j, int k, V v) +{ +} + +void +foo (void) +{ + bar ((V){}, (V){}, (V){}, (U){}); +}
reply other threads:[~2022-05-27 13:15 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=20220527131538.1DD02395B422@sourceware.org \ --to=rguenth@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).