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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <[email protected]>:

https://gcc.gnu.org/g:fe440c99d6a96498d663c86c0298e1c97e24c410

commit r17-423-gfe440c99d6a96498d663c86c0298e1c97e24c410
Author: Andrew Pinski <[email protected]>
Date:   Fri May 8 18:32:50 2026 -0700

    cfghooks: constifify cfg_hooks [PR117871]

    This constifies the hooks so the structs can't be changed at runtime.
    The only odd place where we need to handle special is sel-sched.
    This is because we make a copy of the current cfghooks and then
    use its own.  This changes things slightly there, there is still a
    copy used but instead of copying back into the current cfghooks, we
    just change the pointer back to the original one. This code is only
    enabled by ia64 backend by default so I doubt it will change.

    Boostrapped and tested on x86_64-linux-gnu.

            PR middle-end/117871
    gcc/ChangeLog:

            * cfghooks.cc (cfg_hooks): Change the type
            to be a pointer to a const struct cfg_hooks.
            (get_cfg_hooks): Return the current pointer
            rather the struct.
            (set_cfg_hooks): Change the argument type and
            set the cfg_hooks directly to it.
            * cfghooks.h (gimple_cfg_hooks): Constify.
            (rtl_cfg_hooks): Likewise.
            (cfg_layout_rtl_cfg_hooks): Likewise.
            (get_cfg_hooks): Update declration.
            (set_cfg_hooks): Likewise.
            * cfgrtl.cc (rtl_cfg_hooks): Constify.
            (cfg_layout_rtl_cfg_hooks): Likewise.
            * sel-sched-ir.cc (orig_cfg_hooks): Change to a pointer.
            (sel_create_basic_block): Update
            for orig_cfg_hooks being a pointer.
            (sel_register_cfg_hooks): Update for the constification
            of cfg_hooks.
            * tree-cfg.cc (gimple_cfg_hooks): Constify.

    Signed-off-by: Andrew Pinski <[email protected]>

Reply via email to