public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-10768] middle-end/105140 - fix bogus recursion in fold_convertible_p
@ 2022-05-27 13:15 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2022-05-27 13:15 UTC (permalink / raw)
To: gcc-cvs
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){});
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-27 13:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-27 13:15 [gcc r10-10768] middle-end/105140 - fix bogus recursion in fold_convertible_p Richard Biener
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).