https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107353
--- Comment #13 from Alexander Monakov <amonakov at gcc dot gnu.org> --- As for the Fortran testcases, the issue is again caused by the front-end invoking decl_default_tls_model before assigning DECL_COMMON, this time in fortran/trans-common.cc:build_common_decl. So I guess I can be happy that the assert uncovered issues in three front-ends, and adjust the code to avoid downgrading TLS model instead of asserting: diff --git a/gcc/ipa-visibility.cc b/gcc/ipa-visibility.cc index 3ed2b7cf6..bb86005e5 100644 --- a/gcc/ipa-visibility.cc +++ b/gcc/ipa-visibility.cc @@ -886,8 +886,8 @@ function_and_variable_visibility (bool whole_program) && vnode->ref_list.referring.length ()) { enum tls_model new_model = decl_default_tls_model (decl); - gcc_checking_assert (new_model >= decl_tls_model (decl)); - set_decl_tls_model (decl, new_model); + if (new_model >= decl_tls_model (decl)) + set_decl_tls_model (decl, new_model); } } }