aboutsummaryrefslogtreecommitdiff
path: root/gcc/attribs.c
diff options
context:
space:
mode:
authorJie Zhang <jie@codesourcery.com>2010-07-23 14:47:46 +0000
committerJie Zhang <jiez@gcc.gnu.org>2010-07-23 14:47:46 +0000
commit61044492190ca68b74f5e9757584f4c3c0c0654c (patch)
treeb7192056c818495d64ebed95b109b7adcbf4d7e8 /gcc/attribs.c
parent9477ccb2b1e059f639abf2483893f2b950d34fed (diff)
downloadgcc-61044492190ca68b74f5e9757584f4c3c0c0654c.zip
gcc-61044492190ca68b74f5e9757584f4c3c0c0654c.tar.gz
gcc-61044492190ca68b74f5e9757584f4c3c0c0654c.tar.bz2
re PR target/44290 (__naked attribute is broken)
PR target/44290 * attribs.c (decl_attributes): Insert "noinline" and "noclone" if "naked". * tree-sra.c (ipa_sra_preliminary_function_checks): Return false if ! tree_versionable_function_p. testsuite/ PR target/44290 * gcc.dg/pr44290-1.c: New test. * gcc.dg/pr44290-2.c: New test. From-SVN: r162466
Diffstat (limited to 'gcc/attribs.c')
-rw-r--r--gcc/attribs.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/attribs.c b/gcc/attribs.c
index 0d7c132..d8daa6f 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -276,6 +276,19 @@ decl_attributes (tree *node, tree attributes, int flags)
TREE_VALUE (cur_attr) = chainon (opts, TREE_VALUE (cur_attr));
}
+ /* A "naked" function attribute implies "noinline" and "noclone" for
+ those targets that support it. */
+ if (TREE_CODE (*node) == FUNCTION_DECL
+ && lookup_attribute_spec (get_identifier ("naked"))
+ && lookup_attribute ("naked", attributes) != NULL)
+ {
+ if (lookup_attribute ("noinline", attributes) == NULL)
+ attributes = tree_cons (get_identifier ("noinline"), NULL, attributes);
+
+ if (lookup_attribute ("noclone", attributes) == NULL)
+ attributes = tree_cons (get_identifier ("noclone"), NULL, attributes);
+ }
+
targetm.insert_attributes (*node, &attributes);
for (a = attributes; a; a = TREE_CHAIN (a))