aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-02-27 06:34:23 -0800
committerNathan Sidwell <nathan@acm.org>2020-02-27 06:34:23 -0800
commitda5f369df6dc500183737e251eb19d91f899b92d (patch)
tree8a092dec50f1b1a78e0ef7516058c9e0d8a1b0b0 /gcc
parente94f2542305ccb5c4a3c4e5e8212713747623417 (diff)
downloadgcc-da5f369df6dc500183737e251eb19d91f899b92d.zip
gcc-da5f369df6dc500183737e251eb19d91f899b92d.tar.gz
gcc-da5f369df6dc500183737e251eb19d91f899b92d.tar.bz2
Fix broken type comparison assert
In implementing Jason's suggested direction for 93933, the compiler exploded in a surprising way. Turns out an assert had been passing NULLS to comptypes, and therefore not checking what it intended. Further comptypes, could silently accept such nulls under most circumstances. * class.c (adjust_clone_args): Correct arg-checking assert. * typeck.c (comptypes): Assert not nulls.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/class.c4
-rw-r--r--gcc/cp/typeck.c3
3 files changed, 10 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b2d952d..5e9eeec 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2020-02-27 Nathan Sidwell <nathan@acm.org>
+
+ * class.c (adjust_clone_args): Correct arg-checking assert.
+ * typeck.c (comptypes): Assert not nulls.
+
2020-02-26 Marek Polacek <polacek@redhat.com>
PR c++/93789 - ICE with invalid array bounds.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 6b779da..b3787f7 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -4900,8 +4900,8 @@ adjust_clone_args (tree decl)
break;
}
- gcc_assert (same_type_p (TREE_TYPE (decl_parms),
- TREE_TYPE (clone_parms)));
+ gcc_checking_assert (same_type_p (TREE_VALUE (decl_parms),
+ TREE_VALUE (clone_parms)));
if (TREE_PURPOSE (decl_parms) && !TREE_PURPOSE (clone_parms))
{
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 103a1a4..42d0b47 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1483,10 +1483,13 @@ structural_comptypes (tree t1, tree t2, int strict)
bool
comptypes (tree t1, tree t2, int strict)
{
+ gcc_checking_assert (t1 && t2);
+
if (strict == COMPARE_STRICT && comparing_specializations
&& (t1 != TYPE_CANONICAL (t1) || t2 != TYPE_CANONICAL (t2)))
/* If comparing_specializations, treat dependent aliases as distinct. */
strict = COMPARE_STRUCTURAL;
+
if (strict == COMPARE_STRICT)
{
if (t1 == t2)