Commit da5f369d by Nathan Sidwell

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.
parent e94f2542
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> 2020-02-26 Marek Polacek <polacek@redhat.com>
PR c++/93789 - ICE with invalid array bounds. PR c++/93789 - ICE with invalid array bounds.
......
...@@ -4900,8 +4900,8 @@ adjust_clone_args (tree decl) ...@@ -4900,8 +4900,8 @@ adjust_clone_args (tree decl)
break; break;
} }
gcc_assert (same_type_p (TREE_TYPE (decl_parms), gcc_checking_assert (same_type_p (TREE_VALUE (decl_parms),
TREE_TYPE (clone_parms))); TREE_VALUE (clone_parms)));
if (TREE_PURPOSE (decl_parms) && !TREE_PURPOSE (clone_parms)) if (TREE_PURPOSE (decl_parms) && !TREE_PURPOSE (clone_parms))
{ {
......
...@@ -1483,10 +1483,13 @@ structural_comptypes (tree t1, tree t2, int strict) ...@@ -1483,10 +1483,13 @@ structural_comptypes (tree t1, tree t2, int strict)
bool bool
comptypes (tree t1, tree t2, int strict) comptypes (tree t1, tree t2, int strict)
{ {
gcc_checking_assert (t1 && t2);
if (strict == COMPARE_STRICT && comparing_specializations if (strict == COMPARE_STRICT && comparing_specializations
&& (t1 != TYPE_CANONICAL (t1) || t2 != TYPE_CANONICAL (t2))) && (t1 != TYPE_CANONICAL (t1) || t2 != TYPE_CANONICAL (t2)))
/* If comparing_specializations, treat dependent aliases as distinct. */ /* If comparing_specializations, treat dependent aliases as distinct. */
strict = COMPARE_STRUCTURAL; strict = COMPARE_STRUCTURAL;
if (strict == COMPARE_STRICT) if (strict == COMPARE_STRICT)
{ {
if (t1 == t2) if (t1 == t2)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment