https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114968

--- Comment #6 from LIU Hao <lh_mouse at 126 dot com> ---
I suspect this isn't correct. I am getting strange errors like 'ld exited with
code 5'  not sure what could cause it (possibly also recent MSYS2 updates):

```
diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index 2af026d255d..f5dce6a93bc 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -9669,6 +9669,16 @@ get_atexit_fn_ptr_type (void)

       fn_type = build_function_type_list (void_type_node,
                                          arg_type, NULL_TREE);
+#ifdef IX86_CALLCVT_THISCALL
+      if (flag_use_cxa_atexit
+          && !targetm.cxx.use_atexit_for_cxa_atexit ())
+        {
+          fn_type = copy_node (fn_type);
+          TYPE_ATTRIBUTES (fn_type) = tree_cons (
+                    get_identifier ("thiscall"), NULL_TREE,
+                    TYPE_ATTRIBUTES (fn_type));
+        }
+#endif
       atexit_fn_ptr_type_node = build_pointer_type (fn_type);
     }

diff --git a/gcc/cp/except.cc b/gcc/cp/except.cc
index f1ffda22fd3..00a8843fa2e 100644
--- a/gcc/cp/except.cc
+++ b/gcc/cp/except.cc
@@ -648,6 +648,12 @@ build_throw (location_t loc, tree exp, tsubst_flags_t
complain)
        {
          tree tmp = build_function_type_list (void_type_node,
                                               ptr_type_node, NULL_TREE);
+#ifdef IX86_CALLCVT_THISCALL
+          tmp = copy_node (tmp);
+          TYPE_ATTRIBUTES (tmp) = tree_cons (
+                    get_identifier ("thiscall"), NULL_TREE,
+                    TYPE_ATTRIBUTES (tmp));
+#endif
          cleanup_type = build_pointer_type (tmp);
        }


```

Reply via email to