diff options
author | Martin Sebor <msebor@redhat.com> | 2021-02-01 09:08:21 -0700 |
---|---|---|
committer | Martin Sebor <msebor@redhat.com> | 2021-02-01 09:09:52 -0700 |
commit | 0718336a5284dd5b40fd6691a94d6be93a80f279 (patch) | |
tree | b873cfd81012cb3152afe090d344c4cb7f9aa89b /gcc/c/c-decl.c | |
parent | 90c9b2c17688f7be434415e90c5a655a6ecfaa9e (diff) | |
download | gcc-0718336a5284dd5b40fd6691a94d6be93a80f279.zip gcc-0718336a5284dd5b40fd6691a94d6be93a80f279.tar.gz gcc-0718336a5284dd5b40fd6691a94d6be93a80f279.tar.bz2 |
Reset front end trees before they make it into the middle end (PR middle-end/97172).
gcc/ChangeLog:
PR middle-end/97172
* attribs.c (attr_access::free_lang_data): Define new function.
* attribs.h (attr_access::free_lang_data): Declare new function.
gcc/c/ChangeLog:
PR middle-end/97172
* c-decl.c (free_attr_access_data): New function.
(c_parse_final_cleanups): Call free_attr_access_data.
gcc/testsuite/ChangeLog:
PR middle-end/97172
* gcc.dg/pr97172.c: New test.
Diffstat (limited to 'gcc/c/c-decl.c')
-rw-r--r-- | gcc/c/c-decl.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 4ba9477..be95643 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -12146,6 +12146,27 @@ collect_source_refs (void) collect_source_ref (DECL_SOURCE_FILE (decl)); } +/* Free attribute access data that are not needed by the middle end. */ + +static void +free_attr_access_data () +{ + struct cgraph_node *n; + + /* Iterate over all functions declared in the translation unit. */ + FOR_EACH_FUNCTION (n) + { + tree fntype = TREE_TYPE (n->decl); + if (!fntype) + continue; + tree attrs = TYPE_ATTRIBUTES (fntype); + if (!attrs) + continue; + + attr_access::free_lang_data (attrs); + } +} + /* Perform any final parser cleanups and generate initial debugging information. */ @@ -12190,6 +12211,9 @@ c_parse_final_cleanups (void) c_write_global_declarations_1 (BLOCK_VARS (DECL_INITIAL (t))); c_write_global_declarations_1 (BLOCK_VARS (ext_block)); + if (!in_lto_p) + free_attr_access_data (); + timevar_stop (TV_PHASE_DEFERRED); timevar_start (TV_PHASE_PARSING); |