* Fix builtin decls generated in tree.c
@ 2020-10-26 21:49 Jan Hubicka
2020-10-27 7:34 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Jan Hubicka @ 2020-10-26 21:49 UTC (permalink / raw)
To: gcc-patches, rguenther
Hi,
tree.c still produces "fn spec" attribute for memcpy, memmove and
memset. This is not desirable since "1" is less informative than
fnspec builtin_fnspec returns.
Also the buitin would fire checker, since it misses the second caracter,
so probably the whole logic is unused.
Bootstrapped/regtested x86_64-linux, OK?
gcc/ChangeLog:
2020-10-26 Jan Hubicka <hubicka@ucw.cz>
* tree.c (set_call_expr_flags): Fix string for ECF_RET1.
(build_common_builtin_nodes): Do not set ECF_RET1 for memcpy, memmove,
and memset. They are handled by builtin_fnspec.
diff --git a/gcc/tree.c b/gcc/tree.c
index 6759ac8179a..218dc00f220 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -10514,7 +10514,7 @@ set_call_expr_flags (tree decl, int flags)
if (flags & ECF_RET1)
DECL_ATTRIBUTES (decl)
= tree_cons (get_identifier ("fn spec"),
- build_tree_list (NULL_TREE, build_string (1, "1")),
+ build_tree_list (NULL_TREE, build_string (2, "1 ")),
DECL_ATTRIBUTES (decl));
if ((flags & ECF_TM_PURE) && flag_tm)
apply_tm_attr (decl, get_identifier ("transaction_pure"));
@@ -10576,10 +10576,10 @@ build_common_builtin_nodes (void)
if (!builtin_decl_explicit_p (BUILT_IN_MEMCPY))
local_define_builtin ("__builtin_memcpy", ftype, BUILT_IN_MEMCPY,
- "memcpy", ECF_NOTHROW | ECF_LEAF | ECF_RET1);
+ "memcpy", ECF_NOTHROW | ECF_LEAF);
if (!builtin_decl_explicit_p (BUILT_IN_MEMMOVE))
local_define_builtin ("__builtin_memmove", ftype, BUILT_IN_MEMMOVE,
- "memmove", ECF_NOTHROW | ECF_LEAF | ECF_RET1);
+ "memmove", ECF_NOTHROW | ECF_LEAF);
}
if (!builtin_decl_explicit_p (BUILT_IN_MEMCMP))
@@ -10597,7 +10597,7 @@ build_common_builtin_nodes (void)
ptr_type_node, integer_type_node,
size_type_node, NULL_TREE);
local_define_builtin ("__builtin_memset", ftype, BUILT_IN_MEMSET,
- "memset", ECF_NOTHROW | ECF_LEAF | ECF_RET1);
+ "memset", ECF_NOTHROW | ECF_LEAF);
}
/* If we're checking the stack, `alloca' can throw. */
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Fix builtin decls generated in tree.c
2020-10-26 21:49 Fix builtin decls generated in tree.c Jan Hubicka
@ 2020-10-27 7:34 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2020-10-27 7:34 UTC (permalink / raw)
To: Jan Hubicka; +Cc: gcc-patches
On Mon, 26 Oct 2020, Jan Hubicka wrote:
> Hi,
> tree.c still produces "fn spec" attribute for memcpy, memmove and
> memset. This is not desirable since "1" is less informative than
> fnspec builtin_fnspec returns.
>
> Also the buitin would fire checker, since it misses the second caracter,
> so probably the whole logic is unused.
The memcpy & friends code should fire for FEs not initializing the
builtins. The set_call_expr_flags code still fires for sanitizer
builtins it seems (where sanitizer.def doesn't use RET_1 anywhere).
> Bootstrapped/regtested x86_64-linux, OK?
OK.
Richard.
> gcc/ChangeLog:
>
> 2020-10-26 Jan Hubicka <hubicka@ucw.cz>
>
> * tree.c (set_call_expr_flags): Fix string for ECF_RET1.
> (build_common_builtin_nodes): Do not set ECF_RET1 for memcpy, memmove,
> and memset. They are handled by builtin_fnspec.
>
> diff --git a/gcc/tree.c b/gcc/tree.c
> index 6759ac8179a..218dc00f220 100644
> --- a/gcc/tree.c
> +++ b/gcc/tree.c
> @@ -10514,7 +10514,7 @@ set_call_expr_flags (tree decl, int flags)
> if (flags & ECF_RET1)
> DECL_ATTRIBUTES (decl)
> = tree_cons (get_identifier ("fn spec"),
> - build_tree_list (NULL_TREE, build_string (1, "1")),
> + build_tree_list (NULL_TREE, build_string (2, "1 ")),
> DECL_ATTRIBUTES (decl));
> if ((flags & ECF_TM_PURE) && flag_tm)
> apply_tm_attr (decl, get_identifier ("transaction_pure"));
> @@ -10576,10 +10576,10 @@ build_common_builtin_nodes (void)
>
> if (!builtin_decl_explicit_p (BUILT_IN_MEMCPY))
> local_define_builtin ("__builtin_memcpy", ftype, BUILT_IN_MEMCPY,
> - "memcpy", ECF_NOTHROW | ECF_LEAF | ECF_RET1);
> + "memcpy", ECF_NOTHROW | ECF_LEAF);
> if (!builtin_decl_explicit_p (BUILT_IN_MEMMOVE))
> local_define_builtin ("__builtin_memmove", ftype, BUILT_IN_MEMMOVE,
> - "memmove", ECF_NOTHROW | ECF_LEAF | ECF_RET1);
> + "memmove", ECF_NOTHROW | ECF_LEAF);
> }
>
> if (!builtin_decl_explicit_p (BUILT_IN_MEMCMP))
> @@ -10597,7 +10597,7 @@ build_common_builtin_nodes (void)
> ptr_type_node, integer_type_node,
> size_type_node, NULL_TREE);
> local_define_builtin ("__builtin_memset", ftype, BUILT_IN_MEMSET,
> - "memset", ECF_NOTHROW | ECF_LEAF | ECF_RET1);
> + "memset", ECF_NOTHROW | ECF_LEAF);
> }
>
> /* If we're checking the stack, `alloca' can throw. */
>
--
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imend
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-27 7:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26 21:49 Fix builtin decls generated in tree.c Jan Hubicka
2020-10-27 7:34 ` Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).