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

--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <[email protected]>:

https://gcc.gnu.org/g:4b39b84072e9a57e19761583950fe96b2611720e

commit r17-1153-g4b39b84072e9a57e19761583950fe96b2611720e
Author: H.J. Lu <[email protected]>
Date:   Wed May 6 20:58:47 2026 +0800

    c/c++: Declare stack protection guard in file scope

    When stack protection guard is declared in c_common_nodes_and_builtins,
    it is put in the externals scope outside file scope which triggers
    -Wnested-externs warning in C:

    cc1: warning: nested extern declaration of '__stack_chk_guard'
[-Wnested-externs]

    Declare stack protection guard in file scope instead.

    gcc/c-family/

            PR c/121911
            * c-common.cc (c_common_nodes_and_builtins): Don't declare stack
            protection guard here.

    gcc/c/

            PR c/121911
            * c-decl.cc (push_file_scope): Add stack protection guard to
            visible_builtins.

    gcc/cp/

            PR c/121911
            * decl.cc (cxx_init_decl_processing ): Declare stack protection
            guard after calling c_common_nodes_and_builtins.

    gcc/testsuite/

            PR c/121911
            * gcc.dg/Wnested-externs-1.c: Add -mstack-protector-guard=global
            for x86.

    Signed-off-by: H.J. Lu <[email protected]>

Reply via email to