diff options
author | Richard Biener <rguenther@suse.de> | 2023-12-11 10:08:24 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-12-12 15:25:24 +0100 |
commit | eee13a3730bd1d7aa7b40687b1ee49c17d95159f (patch) | |
tree | 54ccfb8771a04e75c16c269a9415d7e3990cc1c2 /gcc/c-family/c-attribs.cc | |
parent | 878cb5acf0c499702ffd315e273f55e8bd0970b8 (diff) | |
download | gcc-eee13a3730bd1d7aa7b40687b1ee49c17d95159f.zip gcc-eee13a3730bd1d7aa7b40687b1ee49c17d95159f.tar.gz gcc-eee13a3730bd1d7aa7b40687b1ee49c17d95159f.tar.bz2 |
ipa/92606 - properly handle no_icf attribute for variables
The following adds no_icf handling for variables where the attribute
was rejected. It also fixes the check for no_icf by checking both
the source and the targets decl.
PR ipa/92606
gcc/c-family/
* c-attribs.cc (handle_noicf_attribute): Also allow the
attribute on global variables.
gcc/
* ipa-icf.cc (sem_item_optimizer::merge_classes): Check
both source and alias for the no_icf attribute.
* doc/extend.texi (no_icf): Document variable attribute.
Diffstat (limited to 'gcc/c-family/c-attribs.cc')
-rw-r--r-- | gcc/c-family/c-attribs.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/c-family/c-attribs.cc b/gcc/c-family/c-attribs.cc index 854e987..a3671fe 100644 --- a/gcc/c-family/c-attribs.cc +++ b/gcc/c-family/c-attribs.cc @@ -1649,7 +1649,8 @@ handle_noicf_attribute (tree *node, tree name, tree ARG_UNUSED (args), int ARG_UNUSED (flags), bool *no_add_attrs) { - if (TREE_CODE (*node) != FUNCTION_DECL) + if (TREE_CODE (*node) != FUNCTION_DECL + && (TREE_CODE (*node) != VAR_DECL || !is_global_var (*node))) { warning (OPT_Wattributes, "%qE attribute ignored", name); *no_add_attrs = true; |