[gcc r16-8185] i386: Set TREE_PUBLIC on TYPE_NAME of __va_list_tag [PR124565]

Jakub Jelinek jakub@gcc.gnu.org
Fri Mar 20 08:12:07 GMT 2026


https://gcc.gnu.org/g:1d18aa923eaa1a7b5810c4a45ae354eebf8f017f

commit r16-8185-g1d18aa923eaa1a7b5810c4a45ae354eebf8f017f
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Mar 20 09:11:28 2026 +0100

    i386: Set TREE_PUBLIC on TYPE_NAME of __va_list_tag [PR124565]
    
     module;
     #include <cstdarg>
     export module pr124565;
     export namespace std {
       using std::va_list;
     }
    fails on alpha-linux with -fmodules:
    pr124565.cc:5:14: error: exporting ‘typedef __gnuc_va_list va_list’ that does not have external linkage
    <built-in>: note: ‘typedef struct __va_list_tag __va_list_tag’ declared here with internal linkage
    
    It doesn't fail on x86_64-linux because there va_list is __va_list_tag[]
    (i.e. array type), while on alpha-linux it is __va_list_tag itself; and the
    module code calls decl_linkage on it and returns lk_internal for C++11 and
    later.
    
    Now, decl_linkage on x86_64-linux on __va_list_tag directly also returns
    incorrectly lk_internal, and as I have no way to test alpha, I've
    bootstrapped/regtested on x86_64-linux and i686-linux the following patch.
    
    IMHO it is still desirable even there even when it is just a latent issue.
    
    2026-03-20  Jakub Jelinek  <jakub@redhat.com>
    
            PR target/124565
            * config/i386/i386.cc (ix86_build_builtin_va_list_64): Set TREE_PUBLIC
            on type_decl.

Diff:
---
 gcc/config/i386/i386.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index c43c3ac18acf..4c32e21788ac 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -4564,6 +4564,7 @@ ix86_build_builtin_va_list_64 (void)
   DECL_CHAIN (f_gpr) = f_fpr;
   DECL_CHAIN (f_fpr) = f_ovf;
   DECL_CHAIN (f_ovf) = f_sav;
+  TREE_PUBLIC (type_decl) = 1;
 
   layout_type (record);


More information about the Gcc-cvs mailing list