public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] cp: Use same_type_p in cp_build_binary_op for intcap check
@ 2022-06-13 10:13 Alex Coplan
0 siblings, 0 replies; only message in thread
From: Alex Coplan @ 2022-06-13 10:13 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:b479d8363d3f0387747de0d039ad9870d3908624
commit b479d8363d3f0387747de0d039ad9870d3908624
Author: Alex Coplan <alex.coplan@arm.com>
Date: Sat May 7 18:38:44 2022 +0100
cp: Use same_type_p in cp_build_binary_op for intcap check
This fixes an ICE seen with the following testcase (reduced from building
purecap libstdc++):
typedef long T;
T sz;
__intcap f() {
return sz + (__intcap)f;
}
the issue here is that we have two different non-capability types: T and
long are both really the same type, but are represented by different
nodes in the IR, so pointer equality fails us, and we ICE in
cp_build_binary_op. Adjust the check to use same_type_p instead.
gcc/cp/ChangeLog:
* typeck.c (cp_build_binary_op): Use same_type_p to check the
non-capability type of the final intcap type is the same type as
the type we did the arithmetic in.
Diff:
---
gcc/cp/typeck.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 84fecd410cf..5bab85e412b 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -5879,7 +5879,7 @@ cp_build_binary_op (const op_location_t &location,
{
tree ic_type = cp_common_type (TREE_TYPE (intcap),
TREE_TYPE (result));
- gcc_assert (TREE_TYPE (result) == noncapability_type (ic_type));
+ gcc_assert (same_type_p (TREE_TYPE (result), noncapability_type (ic_type)));
intcap = cp_convert (ic_type, intcap, complain);
result = fold_build_replace_address_value_loc (location,
intcap,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-13 10:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-13 10:13 [gcc(refs/vendors/ARM/heads/morello)] cp: Use same_type_p in cp_build_binary_op for intcap check Alex Coplan
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).