diff --git a/gcc/ipa-visibility.cc b/gcc/ipa-visibility.cc
index 3ed2b7cf6797d130dacfbc26c4ec31c5ff1f1dfe..238f7eb84d43009bf2219e7db43dbf9c2d6e505e 100644
--- a/gcc/ipa-visibility.cc
+++ b/gcc/ipa-visibility.cc
@@ -886,8 +886,12 @@ 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);
+	      STATIC_ASSERT (TLS_MODEL_GLOBAL_DYNAMIC < TLS_MODEL_LOCAL_DYNAMIC);
+	      STATIC_ASSERT (TLS_MODEL_INITIAL_EXEC < TLS_MODEL_LOCAL_EXEC);
+	      /* We'd prefer to assert that recomputed model is not weaker than
+		 what the front-end assigned, but cannot: see PR 107353.  */
+	      if (new_model >= decl_tls_model (decl))
+		set_decl_tls_model (decl, new_model);
 	    }
 	}
     }