public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-1752] tree-inline: Fix TREE_READONLY of parameter replacements
@ 2021-06-23 16:58 Martin Jambor
0 siblings, 0 replies; only message in thread
From: Martin Jambor @ 2021-06-23 16:58 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:53330b7d6848209d658c02be76c36aa5475a88c9
commit r12-1752-g53330b7d6848209d658c02be76c36aa5475a88c9
Author: Martin Jambor <mjambor@suse.cz>
Date: Wed Jun 23 18:46:04 2021 +0200
tree-inline: Fix TREE_READONLY of parameter replacements
tree-inline leaves behind VAR_DECLs which are TREE_READONLY (because
they are copies of const parameters) but are written to because they
need to be initialized. This patch resets the flag unconditionally so
that this does not happen.
There are other sources of variables which are incorrectly marked as
TREE_READOLY, but with this patch and a verifier catching them I can
at least compile the Ada run-time library.
gcc/ChangeLog:
2021-06-22 Richard Biener <rguenther@suse.de>
Martin Jambor <mjambor@suse.cz>
* tree-inline.c (setup_one_parameter): Set TREE_READONLY of the
param replacement unconditionally. Adjust comment.
Diff:
---
gcc/tree-inline.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 4a0dc3b6b60..c5f6ba5fe18 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -3491,17 +3491,11 @@ setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn,
automatically replaced by the VAR_DECL. */
insert_decl_map (id, p, var);
- /* Even if P was TREE_READONLY, the new VAR should not be.
- In the original code, we would have constructed a
- temporary, and then the function body would have never
- changed the value of P. However, now, we will be
- constructing VAR directly. The constructor body may
- change its value multiple times as it is being
- constructed. Therefore, it must not be TREE_READONLY;
- the back-end assumes that TREE_READONLY variable is
- assigned to only once. */
- if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (p)))
- TREE_READONLY (var) = 0;
+ /* Even if P was TREE_READONLY, the new VAR should not be. In the original
+ code, we would have constructed a temporary, and then the function body
+ would have never changed the value of P. However, now, we will be
+ constructing VAR directly. Therefore, it must not be TREE_READONLY. */
+ TREE_READONLY (var) = 0;
tree rhs = value;
if (value
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-23 16:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-23 16:58 [gcc r12-1752] tree-inline: Fix TREE_READONLY of parameter replacements Martin Jambor
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).