aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.h
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2022-02-02 14:24:39 +0100
committerRichard Biener <rguenther@suse.de>2022-02-04 08:16:50 +0100
commit551aa75778a4c5165d9533cd447c8fc822f583e1 (patch)
tree8a8afc73ba389c2efb5cf820afd7851f5aa64761 /gcc/tree.h
parente78d98f76f8d6ee4d06fc98f7f7c3ea4b86c828c (diff)
downloadgcc-551aa75778a4c5165d9533cd447c8fc822f583e1.zip
gcc-551aa75778a4c5165d9533cd447c8fc822f583e1.tar.gz
gcc-551aa75778a4c5165d9533cd447c8fc822f583e1.tar.bz2
Add CLOBBER_EOL to mark storage end-of-life clobbers
This adds a flag to CONSTRUCTOR nodes indicating that for clobbers this marks the end-of-life of storage as opposed to just ending the lifetime of the object that occupied it. The dangling pointer diagnostics uses CLOBBERs but is confused by those emitted by the C++ frontend for example which emits them for the second purpose at the start of CTORs. The issue is also appearant for aarch64 in PR104092. Distinguishing the two cases is also necessary for the PR90348 fix. Since I'm going to add another flag I added an enum clobber_flags and a defaulted argument to build_clobber plus a convenient way to query the enum from the CTOR tree and specify it for gimple_clobber_p. Since 'CLOBBER' is already taken and I needed a name for the unspecified clobber we have now I used 'CLOBBER_UNDEF'. 2022-02-03 Richard Biener <rguenther@suse.de> PR middle-end/90348 PR middle-end/104092 gcc/ * tree-core.h (clobber_kind): New enum. (tree_base::u::bits::address_space): Document use in CONSTRUCTORs. * tree.h (CLOBBER_KIND): Add. (build_clobber): Add clobber kind argument, defaulted to CLOBBER_UNDEF. * tree.cc (build_clobber): Likewise. * gimple.h (gimple_clobber_p): New overload with specified kind. * tree-streamer-in.cc (streamer_read_tree_bitfields): Stream CLOBBER_KIND. * tree-streamer-out.cc (streamer_write_tree_bitfields): Likewise. * tree-pretty-print.cc (dump_generic_node): Mark EOL CLOBBERs. * gimplify.cc (gimplify_bind_expr): Build storage end-of-life clobbers with CLOBBER_EOL. (gimplify_target_expr): Likewise. * tree-inline.cc (expand_call_inline): Likewise. * tree-ssa-ccp.cc (insert_clobber_before_stack_restore): Likewise. * gimple-ssa-warn-access.cc (pass_waccess::check_stmt): Only treat CLOBBER_EOL clobbers as ending lifetime of storage. gcc/lto/ * lto-common.cc (compare_tree_sccs_1): Compare CLOBBER_KIND. gcc/testsuite/ * gcc.dg/pr87052.c: Adjust.
Diffstat (limited to 'gcc/tree.h')
-rw-r--r--gcc/tree.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/tree.h b/gcc/tree.h
index e2157d6..95334b0 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1155,6 +1155,10 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
#define TREE_CLOBBER_P(NODE) \
(TREE_CODE (NODE) == CONSTRUCTOR && TREE_THIS_VOLATILE (NODE))
+/* Return the clobber_kind of a CLOBBER CONSTRUCTOR. */
+#define CLOBBER_KIND(NODE) \
+ (CONSTRUCTOR_CHECK (NODE)->base.u.bits.address_space)
+
/* Define fields and accessors for some nodes that represent expressions. */
/* Nonzero if NODE is an empty statement (NOP_EXPR <0>). */
@@ -4559,7 +4563,7 @@ extern tree build_constructor_single (tree, tree, tree);
extern tree build_constructor_from_list (tree, tree);
extern tree build_constructor_from_vec (tree, const vec<tree, va_gc> *);
extern tree build_constructor_va (tree, int, ...);
-extern tree build_clobber (tree);
+extern tree build_clobber (tree, enum clobber_kind = CLOBBER_UNDEF);
extern tree build_real_from_int_cst (tree, const_tree);
extern tree build_real_from_wide (tree, const wide_int_ref &, signop);
extern tree build_complex (tree, tree, tree);