[patch c++, ada, middle-end]: PR 38662 - __fastcall confuses a function's throw() specification
Kai Tietz
ktietz70@googlemail.com
Fri Dec 31 12:21:00 GMT 2010
Hello,
For METHOD_TYPEs the language hook wasn't called, which results in
non-considering the exception for type comparison for c++. By this the
first method's throw (or non throw) were applied to all other methods
having similar type.
ChangeLog gcc/
2010-12-31 Kai Tietz
PR target/38662
* tree.c (type_hash_eq): Call
language hook for METHOD_TYPEs, too.
ChangeLog gcc/cp
2010-12-31 Kai Tietz
PR target/38662
* tree.c (cxx_type_hash_eq):
Allow METHOD_TYPE, too.
ChangeLog gcc/ada/
2010-12-31 Kai Tietz
PR target/38662
* gcc-interface/misc.c (gnat_type_hash_eq):
Allow METHOD_TYPE, too.
ChangeLog gcc/testsuite
2010-12-31 Kai Tietz
PR target/38662
* g++.dg/eh/pr38662.C: New testcase.
Tested for i686-pc-cygwin, i686-w64-mingw32, and i686-pc-linux. Ok for apply?
Regards,
Kai
-------------- next part --------------
Index: ada/gcc-interface/misc.c
===================================================================
--- ada/gcc-interface/misc.c (revision 168365)
+++ ada/gcc-interface/misc.c (working copy)
@@ -529,7 +529,8 @@
static bool
gnat_type_hash_eq (const_tree t1, const_tree t2)
{
- gcc_assert (TREE_CODE (t1) == FUNCTION_TYPE);
+ gcc_assert (TREE_CODE (t1) == FUNCTION_TYPE
+ || TREE_CODE (t1) == METHOD_TYPE);
return fntype_same_flags_p (t1, TYPE_CI_CO_LIST (t2),
TYPE_RETURN_UNCONSTRAINED_P (t2),
TYPE_RETURN_BY_DIRECT_REF_P (t2),
-------------- next part --------------
Index: cp/tree.c
===================================================================
--- cp/tree.c (revision 168365)
+++ cp/tree.c (working copy)
@@ -2749,7 +2749,8 @@
bool
cxx_type_hash_eq (const_tree typea, const_tree typeb)
{
- gcc_assert (TREE_CODE (typea) == FUNCTION_TYPE);
+ gcc_assert (TREE_CODE (typea) == FUNCTION_TYPE
+ || TREE_CODE (typea) == METHOD_TYPE);
return comp_except_specs (TYPE_RAISES_EXCEPTIONS (typea),
TYPE_RAISES_EXCEPTIONS (typeb), ce_exact);
-------------- next part --------------
Index: tree.c
===================================================================
--- tree.c (revision 168365)
+++ tree.c (working copy)
@@ -6007,15 +6007,16 @@
return TYPE_OFFSET_BASETYPE (a->type) == TYPE_OFFSET_BASETYPE (b->type);
case METHOD_TYPE:
- return (TYPE_METHOD_BASETYPE (a->type) == TYPE_METHOD_BASETYPE (b->type)
- && (TYPE_ARG_TYPES (a->type) == TYPE_ARG_TYPES (b->type)
- || (TYPE_ARG_TYPES (a->type)
- && TREE_CODE (TYPE_ARG_TYPES (a->type)) == TREE_LIST
- && TYPE_ARG_TYPES (b->type)
- && TREE_CODE (TYPE_ARG_TYPES (b->type)) == TREE_LIST
- && type_list_equal (TYPE_ARG_TYPES (a->type),
- TYPE_ARG_TYPES (b->type)))));
-
+ if (TYPE_METHOD_BASETYPE (a->type) == TYPE_METHOD_BASETYPE (b->type)
+ && (TYPE_ARG_TYPES (a->type) == TYPE_ARG_TYPES (b->type)
+ || (TYPE_ARG_TYPES (a->type)
+ && TREE_CODE (TYPE_ARG_TYPES (a->type)) == TREE_LIST
+ && TYPE_ARG_TYPES (b->type)
+ && TREE_CODE (TYPE_ARG_TYPES (b->type)) == TREE_LIST
+ && type_list_equal (TYPE_ARG_TYPES (a->type),
+ TYPE_ARG_TYPES (b->type)))))
+ break;
+ return 0;
case ARRAY_TYPE:
return TYPE_DOMAIN (a->type) == TYPE_DOMAIN (b->type);
-------------- next part --------------
// { dg-do compile { target { { i?86-*-* x86_64-*-* } && ilp32 } } }
class E { };
class T {
int foo(bool a) throw (E) __attribute__((regparm(1)));
int bar(bool b) __attribute__((regparm(1)));
};
int T::bar(bool b)
{
return (b ? 1 : 2);
}
More information about the Gcc-patches
mailing list