From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailrelay.tugraz.at (mailrelay.tugraz.at [129.27.2.202]) by sourceware.org (Postfix) with ESMTPS id E83B93858C53 for ; Sat, 26 Aug 2023 16:21:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E83B93858C53 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=tugraz.at Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tugraz.at Received: from vra-173-28.tugraz.at (vra-173-28.tugraz.at [129.27.173.28]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4RY2B129jxz3wpZ; Sat, 26 Aug 2023 18:20:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1693066857; bh=stcKgSyvKh1cj6ysTobFNzf7erqlu54V96Cslk3fS+o=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=t74i7tRIEhGBQtRLXuKptd0uNfcqCEw+UWmFM68Sejwnj2A1QRFEjWSDjEa3puky7 vNf7Z+LQ4VKf0x2OI69FzNcC9tbSWMsUOvnajLTIl2NjVIVYZXlHokiqRBpyHEBXzr Rpgx8/NzgMiN8NVLG6QPvFbi8/xD6XM/NZXZAuIc= Message-ID: <1df29de95ff41a02ffd218f4cd69f8f93df35321.camel@tugraz.at> Subject: [C PATCH 1/6] c: reorganize recursive type checking From: Martin Uecker To: gcc-patches@gcc.gnu.org Cc: Joseph Myers Date: Sat, 26 Aug 2023 18:20:57 +0200 In-Reply-To: <4b3866a8cc9b48f3be97c004dedbac8e9149da63.camel@tugraz.at> References: <4b3866a8cc9b48f3be97c004dedbac8e9149da63.camel@tugraz.at> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 MIME-Version: 1.0 X-TUG-Backscatter-control: G/VXY7/6zeyuAY/PU2/0qw X-Spam-Scanner: SpamAssassin 3.003001 X-Spam-Score-relay: -1.9 X-Scanned-By: MIMEDefang 2.74 on 129.27.10.117 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Reorganize recursive type checking to use a structure to store information collected during the recursion and returned to the caller (warning_needed, enum_and_init_p, different_types_p). gcc/c: * c-typeck.cc (struct comptypes_data): Add structure. (tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, comptypes_internal): Add structure to interface, change return type to bool, and adapt calls. (comptarget_types): Change return type too bool. (comptypes, comptypes_check_enum_int, comptypes_check_different_types): Adapt calls. --- gcc/c/c-typeck.cc | 266 ++++++++++++++++++++-------------------------- 1 file changed, 114 insertions(+), 152 deletions(-) diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index e6ddf37d412..ed1520ed6ba 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -90,12 +90,14 @@ static bool require_constant_elements; static bool require_constexpr_value; =20 static tree qualify_type (tree, tree); -static int tagged_types_tu_compatible_p (const_tree, const_tree, bool *, - bool *); -static int comp_target_types (location_t, tree, tree); -static int function_types_compatible_p (const_tree, const_tree, bool *, - bool *); -static int type_lists_compatible_p (const_tree, const_tree, bool *, bool *= ); +struct comptypes_data; +static bool tagged_types_tu_compatible_p (const_tree, const_tree, + struct comptypes_data *); +static bool comp_target_types (location_t, tree, tree); +static bool function_types_compatible_p (const_tree, const_tree, + struct comptypes_data *); +static bool type_lists_compatible_p (const_tree, const_tree, + struct comptypes_data *); static tree lookup_field (tree, tree); static int convert_arguments (location_t, vec, tree, vec *, vec *, tree, @@ -125,7 +127,8 @@ static tree find_init_member (tree, struct obstack *); static void readonly_warning (tree, enum lvalue_use); static int lvalue_or_else (location_t, const_tree, enum lvalue_use); static void record_maybe_used_decl (tree); -static int comptypes_internal (const_tree, const_tree, bool *, bool *); +static bool comptypes_internal (const_tree, const_tree, + struct comptypes_data *data); =0C /* Return true if EXP is a null pointer constant, false otherwise. */ =20 @@ -1039,6 +1042,13 @@ common_type (tree t1, tree t2) return c_common_type (t1, t2); } =20 +struct comptypes_data { + + bool enum_and_int_p; + bool different_types_p; + bool warning_needed; +}; + /* Return 1 if TYPE1 and TYPE2 are compatible types for assignment or various other operations. Return 2 if they are compatible but a warning may be needed if you use them together. */ @@ -1047,12 +1057,13 @@ int comptypes (tree type1, tree type2) { const struct tagged_tu_seen_cache * tagged_tu_seen_base1 =3D tagged_tu_s= een_base; - int val; =20 - val =3D comptypes_internal (type1, type2, NULL, NULL); + struct comptypes_data data =3D { }; + bool ret =3D comptypes_internal (type1, type2, &data); + free_all_tagged_tu_seen_up_to (tagged_tu_seen_base1); =20 - return val; + return ret ? (data.warning_needed ? 2 : 1) : 0; } =20 /* Like comptypes, but if it returns non-zero because enum and int are @@ -1062,12 +1073,14 @@ int comptypes_check_enum_int (tree type1, tree type2, bool *enum_and_int_p) { const struct tagged_tu_seen_cache * tagged_tu_seen_base1 =3D tagged_tu_s= een_base; - int val; =20 - val =3D comptypes_internal (type1, type2, enum_and_int_p, NULL); + struct comptypes_data data =3D { }; + bool ret =3D comptypes_internal (type1, type2, &data); + *enum_and_int_p =3D data.enum_and_int_p; + free_all_tagged_tu_seen_up_to (tagged_tu_seen_base1); =20 - return val; + return ret ? (data.warning_needed ? 2 : 1) : 0; } =20 /* Like comptypes, but if it returns nonzero for different types, it @@ -1078,40 +1091,40 @@ comptypes_check_different_types (tree type1, tree t= ype2, bool *different_types_p) { const struct tagged_tu_seen_cache * tagged_tu_seen_base1 =3D tagged_tu_s= een_base; - int val; =20 - val =3D comptypes_internal (type1, type2, NULL, different_types_p); + struct comptypes_data data =3D { }; + bool ret =3D comptypes_internal (type1, type2, &data); + *different_types_p =3D data.different_types_p; + free_all_tagged_tu_seen_up_to (tagged_tu_seen_base1); =20 - return val; + return ret ? (data.warning_needed ? 2 : 1) : 0; } =0C -/* Return 1 if TYPE1 and TYPE2 are compatible types for assignment - or various other operations. Return 2 if they are compatible - but a warning may be needed if you use them together. If - ENUM_AND_INT_P is not NULL, and one type is an enum and the other a - compatible integer type, then this sets *ENUM_AND_INT_P to true; - *ENUM_AND_INT_P is never set to false. If DIFFERENT_TYPES_P is not - NULL, and the types are compatible but different enough not to be +/* Return true if TYPE1 and TYPE2 are compatible types for assignment + or various other operations. If they are compatible but a warning may + be needed if you use them together, 'warning_needed' in DATA is set. + If one type is an enum and the other a compatible integer type, then + this sets 'enum_and_int_p' in DATA to true (it is never set to + false). If the types are compatible but different enough not to be permitted in C11 typedef redeclarations, then this sets - *DIFFERENT_TYPES_P to true; *DIFFERENT_TYPES_P is never set to + 'different_types_p' in DATA to true; it is never set to false, but may or may not be set if the types are incompatible. This differs from comptypes, in that we don't free the seen types. */ =20 -static int -comptypes_internal (const_tree type1, const_tree type2, bool *enum_and_int= _p, - bool *different_types_p) +static bool +comptypes_internal (const_tree type1, const_tree type2, + struct comptypes_data *data) { const_tree t1 =3D type1; const_tree t2 =3D type2; - int attrval, val; =20 /* Suppress errors caused by previously reported errors. */ =20 if (t1 =3D=3D t2 || !t1 || !t2 || TREE_CODE (t1) =3D=3D ERROR_MARK || TREE_CODE (t2) =3D=3D ERROR_M= ARK) - return 1; + return true; =20 /* Enumerated types are compatible with integer types, but this is not transitive: two enumerated types in the same translation unit @@ -1124,10 +1137,8 @@ comptypes_internal (const_tree type1, const_tree typ= e2, bool *enum_and_int_p, t1 =3D ENUM_UNDERLYING_TYPE (t1); if (TREE_CODE (t2) !=3D VOID_TYPE) { - if (enum_and_int_p !=3D NULL) - *enum_and_int_p =3D true; - if (different_types_p !=3D NULL) - *different_types_p =3D true; + data->enum_and_int_p =3D true; + data->different_types_p =3D true; } } else if (TREE_CODE (t2) =3D=3D ENUMERAL_TYPE @@ -1137,25 +1148,23 @@ comptypes_internal (const_tree type1, const_tree ty= pe2, bool *enum_and_int_p, t2 =3D ENUM_UNDERLYING_TYPE (t2); if (TREE_CODE (t1) !=3D VOID_TYPE) { - if (enum_and_int_p !=3D NULL) - *enum_and_int_p =3D true; - if (different_types_p !=3D NULL) - *different_types_p =3D true; + data->enum_and_int_p =3D true; + data->different_types_p =3D true; } } =20 if (t1 =3D=3D t2) - return 1; + return true; =20 /* Different classes of types can't be compatible. */ =20 if (TREE_CODE (t1) !=3D TREE_CODE (t2)) - return 0; + return false; =20 /* Qualifiers must match. C99 6.7.3p9 */ =20 if (TYPE_QUALS (t1) !=3D TYPE_QUALS (t2)) - return 0; + return false; =20 /* Allow for two different type nodes which have essentially the same definition. Note that we already checked for equality of the type @@ -1163,14 +1172,16 @@ comptypes_internal (const_tree type1, const_tree ty= pe2, bool *enum_and_int_p, =20 if (TREE_CODE (t1) !=3D ARRAY_TYPE && TYPE_MAIN_VARIANT (t1) =3D=3D TYPE_MAIN_VARIANT (t2)) - return 1; + return true; + + int attrval; =20 /* 1 if no need for warning yet, 2 if warning cause has been seen. */ if (!(attrval =3D comp_type_attributes (t1, t2))) - return 0; + return false; =20 - /* 1 if no need for warning yet, 2 if warning cause has been seen. */ - val =3D 0; + if (2 =3D=3D attrval) + data->warning_needed =3D true; =20 switch (TREE_CODE (t1)) { @@ -1196,16 +1207,11 @@ comptypes_internal (const_tree type1, const_tree ty= pe2, bool *enum_and_int_p, case POINTER_TYPE: /* Do not remove mode information. */ if (TYPE_MODE (t1) !=3D TYPE_MODE (t2)) - break; - val =3D (TREE_TYPE (t1) =3D=3D TREE_TYPE (t2) - ? 1 : comptypes_internal (TREE_TYPE (t1), TREE_TYPE (t2), - enum_and_int_p, different_types_p)); - break; + return false; + return comptypes_internal (TREE_TYPE (t1), TREE_TYPE (t2), data); =20 case FUNCTION_TYPE: - val =3D function_types_compatible_p (t1, t2, enum_and_int_p, - different_types_p); - break; + return function_types_compatible_p (t1, t2, data); =20 case ARRAY_TYPE: { @@ -1213,21 +1219,16 @@ comptypes_internal (const_tree type1, const_tree ty= pe2, bool *enum_and_int_p, tree d2 =3D TYPE_DOMAIN (t2); bool d1_variable, d2_variable; bool d1_zero, d2_zero; - val =3D 1; =20 /* Target types must match incl. qualifiers. */ - if (TREE_TYPE (t1) !=3D TREE_TYPE (t2) - && (val =3D comptypes_internal (TREE_TYPE (t1), TREE_TYPE (t2), - enum_and_int_p, - different_types_p)) =3D=3D 0) - return 0; - - if (different_types_p !=3D NULL - && (d1 =3D=3D NULL_TREE) !=3D (d2 =3D=3D NULL_TREE)) - *different_types_p =3D true; + if (!comptypes_internal (TREE_TYPE (t1), TREE_TYPE (t2), data)) + return false; + + if ((d1 =3D=3D NULL_TREE) !=3D (d2 =3D=3D NULL_TREE)) + data->different_types_p =3D true; /* Sizes must match unless one is missing or variable. */ if (d1 =3D=3D NULL_TREE || d2 =3D=3D NULL_TREE || d1 =3D=3D d2) - break; + return true; =20 d1_zero =3D !TYPE_MAX_VALUE (d1); d2_zero =3D !TYPE_MAX_VALUE (d2); @@ -1241,51 +1242,37 @@ comptypes_internal (const_tree type1, const_tree ty= pe2, bool *enum_and_int_p, d1_variable =3D d1_variable || (d1_zero && C_TYPE_VARIABLE_SIZE (t1)); d2_variable =3D d2_variable || (d2_zero && C_TYPE_VARIABLE_SIZE (t2)); =20 - if (different_types_p !=3D NULL - && d1_variable !=3D d2_variable) - *different_types_p =3D true; + if (d1_variable !=3D d2_variable) + data->different_types_p =3D true; if (d1_variable || d2_variable) - break; + return true; if (d1_zero && d2_zero) - break; + return true; if (d1_zero || d2_zero || !tree_int_cst_equal (TYPE_MIN_VALUE (d1), TYPE_MIN_VALUE (d2)) || !tree_int_cst_equal (TYPE_MAX_VALUE (d1), TYPE_MAX_VALUE (d2))) - val =3D 0; + return false; =20 - break; + return true; } =20 case ENUMERAL_TYPE: case RECORD_TYPE: case UNION_TYPE: - if (val !=3D 1 && false) + if (false) { - tree a1 =3D TYPE_ATTRIBUTES (t1); - tree a2 =3D TYPE_ATTRIBUTES (t2); - - if (! attribute_list_contained (a1, a2) - && ! attribute_list_contained (a2, a1)) - break; - - val =3D tagged_types_tu_compatible_p (t1, t2, enum_and_int_p, - different_types_p); - - if (attrval !=3D 2) - return val; + return tagged_types_tu_compatible_p (t1, t2, data); } - break; + return false; =20 case VECTOR_TYPE: - val =3D (known_eq (TYPE_VECTOR_SUBPARTS (t1), TYPE_VECTOR_SUBPARTS (= t2)) - && comptypes_internal (TREE_TYPE (t1), TREE_TYPE (t2), - enum_and_int_p, different_types_p)); - break; + return known_eq (TYPE_VECTOR_SUBPARTS (t1), TYPE_VECTOR_SUBPARTS (t2= )) + && comptypes_internal (TREE_TYPE (t1), TREE_TYPE (t2), data); =20 default: - break; + return false; } - return attrval =3D=3D 2 && val =3D=3D 1 ? 2 : val; + gcc_unreachable (); } =20 /* Return 1 if TTL and TTR are pointers to types that are equivalent, igno= ring @@ -1293,7 +1280,7 @@ comptypes_internal (const_tree type1, const_tree type= 2, bool *enum_and_int_p, different named addresses, then we must determine if one address space = is a subset of the other. */ =20 -static int +static bool comp_target_types (location_t location, tree ttl, tree ttr) { int val; @@ -1395,17 +1382,13 @@ free_all_tagged_tu_seen_up_to (const struct tagged_= tu_seen_cache *tu_til) =20 /* Return 1 if two 'struct', 'union', or 'enum' types T1 and T2 are compatible. If the two types are not the same (which has been - checked earlier), this can only happen when multiple translation - units are being compiled. See C99 6.2.7 paragraph 1 for the exact - rules. ENUM_AND_INT_P and DIFFERENT_TYPES_P are as in - comptypes_internal. */ + checked earlier). */ =20 -static int +static bool tagged_types_tu_compatible_p (const_tree t1, const_tree t2, - bool *enum_and_int_p, bool *different_types_p) + struct comptypes_data* data) { tree s1, s2; - bool needs_warning =3D false; =20 /* We have to verify that the tags of the types are the same. This is harder than it looks because this may be a typedef, so we have @@ -1513,8 +1496,7 @@ tagged_types_tu_compatible_p (const_tree t1, const_tr= ee t2, =20 if (DECL_NAME (s1) !=3D DECL_NAME (s2)) break; - result =3D comptypes_internal (TREE_TYPE (s1), TREE_TYPE (s2), - enum_and_int_p, different_types_p); + result =3D comptypes_internal (TREE_TYPE (s1), TREE_TYPE (s2), data); =20 if (result !=3D 1 && !DECL_NAME (s1)) break; @@ -1523,8 +1505,6 @@ tagged_types_tu_compatible_p (const_tree t1, const_tr= ee t2, tu->val =3D 0; return 0; } - if (result =3D=3D 2) - needs_warning =3D true; =20 if (TREE_CODE (s1) =3D=3D FIELD_DECL && simple_cst_equal (DECL_FIELD_BIT_OFFSET (s1), @@ -1536,7 +1516,6 @@ tagged_types_tu_compatible_p (const_tree t1, const_tr= ee t2, } if (!s1 && !s2) { - tu->val =3D needs_warning ? 2 : 1; return tu->val; } =20 @@ -1550,8 +1529,7 @@ tagged_types_tu_compatible_p (const_tree t1, const_tr= ee t2, int result; =20 result =3D comptypes_internal (TREE_TYPE (s1), TREE_TYPE (s2), - enum_and_int_p, - different_types_p); + data); =20 if (result !=3D 1 && !DECL_NAME (s1)) continue; @@ -1560,8 +1538,6 @@ tagged_types_tu_compatible_p (const_tree t1, const_tr= ee t2, tu->val =3D 0; return 0; } - if (result =3D=3D 2) - needs_warning =3D true; =20 if (TREE_CODE (s1) =3D=3D FIELD_DECL && simple_cst_equal (DECL_FIELD_BIT_OFFSET (s1), @@ -1577,7 +1553,6 @@ tagged_types_tu_compatible_p (const_tree t1, const_tr= ee t2, return 0; } } - tu->val =3D needs_warning ? 2 : 1; return tu->val; } =20 @@ -1599,12 +1574,9 @@ tagged_types_tu_compatible_p (const_tree t1, const_t= ree t2, if (TREE_CODE (s1) !=3D TREE_CODE (s2) || DECL_NAME (s1) !=3D DECL_NAME (s2)) break; - result =3D comptypes_internal (TREE_TYPE (s1), TREE_TYPE (s2), - enum_and_int_p, different_types_p); + result =3D comptypes_internal (TREE_TYPE (s1), TREE_TYPE (s2), data); if (result =3D=3D 0) break; - if (result =3D=3D 2) - needs_warning =3D true; =20 if (TREE_CODE (s1) =3D=3D FIELD_DECL && simple_cst_equal (DECL_FIELD_BIT_OFFSET (s1), @@ -1614,7 +1586,7 @@ tagged_types_tu_compatible_p (const_tree t1, const_tr= ee t2, if (s1 && s2) tu->val =3D 0; else - tu->val =3D needs_warning ? 2 : 1; + tu->val =3D 1; return tu->val; } =20 @@ -1631,9 +1603,9 @@ tagged_types_tu_compatible_p (const_tree t1, const_tr= ee t2, Otherwise, the argument types must match. ENUM_AND_INT_P and DIFFERENT_TYPES_P are as in comptypes_internal. */ =20 -static int +static bool function_types_compatible_p (const_tree f1, const_tree f2, - bool *enum_and_int_p, bool *different_types_p) + struct comptypes_data *data) { tree args1, args2; /* 1 if no need for warning yet, 2 if warning cause has been seen. */ @@ -1654,16 +1626,15 @@ function_types_compatible_p (const_tree f1, const_t= ree f2, if (TYPE_VOLATILE (ret2)) ret2 =3D build_qualified_type (TYPE_MAIN_VARIANT (ret2), TYPE_QUALS (ret2) & ~TYPE_QUAL_VOLATILE); - val =3D comptypes_internal (ret1, ret2, enum_and_int_p, different_types_= p); + val =3D comptypes_internal (ret1, ret2, data); if (val =3D=3D 0) return 0; =20 args1 =3D TYPE_ARG_TYPES (f1); args2 =3D TYPE_ARG_TYPES (f2); =20 - if (different_types_p !=3D NULL - && (args1 =3D=3D NULL_TREE) !=3D (args2 =3D=3D NULL_TREE)) - *different_types_p =3D true; + if ((args1 =3D=3D NULL_TREE) !=3D (args2 =3D=3D NULL_TREE)) + data->different_types_p =3D true; =20 /* An unspecified parmlist matches any specified parmlist whose argument types don't need default promotions. */ @@ -1679,8 +1650,11 @@ function_types_compatible_p (const_tree f1, const_tr= ee f2, If they don't match, ask for a warning (but no error). */ if (TYPE_ACTUAL_ARG_TYPES (f1) && type_lists_compatible_p (args2, TYPE_ACTUAL_ARG_TYPES (f1), - enum_and_int_p, different_types_p) !=3D 1) - val =3D 2; + data) !=3D 1) + { + val =3D 1; + data->warning_needed =3D true; + } return val; } if (args2 =3D=3D NULL_TREE) @@ -1691,35 +1665,32 @@ function_types_compatible_p (const_tree f1, const_t= ree f2, return 0; if (TYPE_ACTUAL_ARG_TYPES (f2) && type_lists_compatible_p (args1, TYPE_ACTUAL_ARG_TYPES (f2), - enum_and_int_p, different_types_p) !=3D 1) - val =3D 2; + data) !=3D 1) + { + val =3D 1; + data->warning_needed =3D true; + } return val; } =20 /* Both types have argument lists: compare them and propagate results. = */ - val1 =3D type_lists_compatible_p (args1, args2, enum_and_int_p, - different_types_p); - return val1 !=3D 1 ? val1 : val; + val1 =3D type_lists_compatible_p (args1, args2, data); + return val1; } =20 /* Check two lists of types for compatibility, returning 0 for - incompatible, 1 for compatible, or 2 for compatible with - warning. ENUM_AND_INT_P and DIFFERENT_TYPES_P are as in - comptypes_internal. */ + incompatible, 1 for compatible. ENUM_AND_INT_P and + DIFFERENT_TYPES_P are as in comptypes_internal. */ =20 -static int +static bool type_lists_compatible_p (const_tree args1, const_tree args2, - bool *enum_and_int_p, bool *different_types_p) + struct comptypes_data *data) { - /* 1 if no need for warning yet, 2 if warning cause has been seen. */ - int val =3D 1; - int newval =3D 0; - while (1) { tree a1, mv1, a2, mv2; if (args1 =3D=3D NULL_TREE && args2 =3D=3D NULL_TREE) - return val; + return true; /* If one list is shorter than the other, they fail to match. */ if (args1 =3D=3D NULL_TREE || args2 =3D=3D NULL_TREE) @@ -1740,9 +1711,8 @@ type_lists_compatible_p (const_tree args1, const_tree= args2, means there is supposed to be an argument but nothing is specified about what type it has. So match anything that self-promotes. */ - if (different_types_p !=3D NULL - && (a1 =3D=3D NULL_TREE) !=3D (a2 =3D=3D NULL_TREE)) - *different_types_p =3D true; + if ((a1 =3D=3D NULL_TREE) !=3D (a2 =3D=3D NULL_TREE)) + data->different_types_p =3D true; if (a1 =3D=3D NULL_TREE) { if (c_type_promotes_to (a2) !=3D a2) @@ -1757,11 +1727,9 @@ type_lists_compatible_p (const_tree args1, const_tre= e args2, else if (TREE_CODE (a1) =3D=3D ERROR_MARK || TREE_CODE (a2) =3D=3D ERROR_MARK) ; - else if (!(newval =3D comptypes_internal (mv1, mv2, enum_and_int_p, - different_types_p))) + else if (!comptypes_internal (mv1, mv2, data)) { - if (different_types_p !=3D NULL) - *different_types_p =3D true; + data->different_types_p =3D true; /* Allow wait (union {union wait *u; int *i} *) and wait (union wait *) to be compatible. */ if (TREE_CODE (a1) =3D=3D UNION_TYPE @@ -1782,8 +1750,7 @@ type_lists_compatible_p (const_tree args1, const_tree= args2, ? c_build_qualified_type (TYPE_MAIN_VARIANT (mv3), TYPE_QUAL_ATOMIC) : TYPE_MAIN_VARIANT (mv3)); - if (comptypes_internal (mv3, mv2, enum_and_int_p, - different_types_p)) + if (comptypes_internal (mv3, mv2, data)) break; } if (memb =3D=3D NULL_TREE) @@ -1807,8 +1774,7 @@ type_lists_compatible_p (const_tree args1, const_tree= args2, ? c_build_qualified_type (TYPE_MAIN_VARIANT (mv3), TYPE_QUAL_ATOMIC) : TYPE_MAIN_VARIANT (mv3)); - if (comptypes_internal (mv3, mv1, enum_and_int_p, - different_types_p)) + if (comptypes_internal (mv3, mv1, data)) break; } if (memb =3D=3D NULL_TREE) @@ -1818,10 +1784,6 @@ type_lists_compatible_p (const_tree args1, const_tre= e args2, return 0; } =20 - /* comptypes said ok, but record if it said to warn. */ - if (newval > val) - val =3D newval; - args1 =3D TREE_CHAIN (args1); args2 =3D TREE_CHAIN (args2); } @@ -7298,7 +7260,7 @@ convert_for_assignment (location_t location, location= _t expr_loc, tree type, tree mvl =3D ttl; tree mvr =3D ttr; bool is_opaque_pointer; - int target_cmp =3D 0; /* Cache comp_target_types () result. */ + bool target_cmp =3D false; /* Cache comp_target_types () result. = */ addr_space_t asl; addr_space_t asr; =20 --=20 2.30.2