aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-01-21 09:04:53 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-01-21 09:04:53 +0000
commitcbf5d0e70c98103d28c869305043d9889bb36c8f (patch)
tree33d3bb74da1e52661a0940e472d95cdc4efa58ef /gcc/gimplify.c
parent1f36fbf4a81d10160f3083d93952ec9d6c8da7f0 (diff)
downloadgcc-cbf5d0e70c98103d28c869305043d9889bb36c8f.zip
gcc-cbf5d0e70c98103d28c869305043d9889bb36c8f.tar.gz
gcc-cbf5d0e70c98103d28c869305043d9889bb36c8f.tar.bz2
re PR middle-end/64313 (gcc.dg/torture/builtin-explog-1.c fails on bare-metal targets)
2015-01-21 Richard Biener <rguenther@suse.de> PR middle-end/64313 * tree-core.h (builtin_info, builtin_info_type): Turn from an object with two arrays into an array of an object with decl and two flags, implicit_p and declared_p. * tree.h (builtin_decl_explicit, builtin_decl_implicit, set_builtin_decl, set_builtin_decl_implicit_p, builtin_decl_explicit_p, builtin_decl_implicit_p): Adjust. (set_builtin_decl_declared_p, builtin_decl_declared_p): New functions. * builtins.c (builtin_info): Adjust. * gimplify.c (gimplify_addr_expr): References to builtins that have been declared by the user makes them eligible for use by the compiler. Call set_builtin_decl_implicit_p on them. c/ * c-decl.c (merge_decls): Call set_builtin_decl_declared_p for builtins the user declared correctly. cp/ * decl.c (duplicate_decls): Call set_builtin_decl_declared_p for builtins the user declared correctly. From-SVN: r219928
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 3a34f92..947b0af 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -4956,6 +4956,14 @@ gimplify_addr_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
break;
default:
+ /* If we see a call to a declared builtin or see its address
+ being taken (we can unify those cases here) then we can mark
+ the builtin for implicit generation by GCC. */
+ if (TREE_CODE (op0) == FUNCTION_DECL
+ && DECL_BUILT_IN_CLASS (op0) == BUILT_IN_NORMAL
+ && builtin_decl_declared_p (DECL_FUNCTION_CODE (op0)))
+ set_builtin_decl_implicit_p (DECL_FUNCTION_CODE (op0), true);
+
/* We use fb_either here because the C frontend sometimes takes
the address of a call that returns a struct; see
gcc.dg/c99-array-lval-1.c. The gimplifier will correctly make