diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py
index e9bfa9fe9..43be47dd5 100644
--- a/Cython/Compiler/ModuleNode.py
+++ b/Cython/Compiler/ModuleNode.py
@@ -376,6 +376,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
         self.generate_includes(env, modules, code, early=False)
 
         code = globalstate['all_the_rest']
+        # Gentoo: workaround for https://github.com/cython/cython/issues/2747
+        # https://bugs.gentoo.org/918983
+        code.putln('#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"')
 
         self.generate_cached_builtins_decls(env, code)
         self.generate_lambda_definitions(env, code)
