aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-fold.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-05-07 09:51:18 +0200
committerRichard Biener <rguenther@suse.de>2021-05-10 11:40:39 +0200
commita076632e274abe344ca7648b7c7f299273d4cbe0 (patch)
tree9f9db39952ed28f660d4af6758c416ebe3afe413 /gcc/gimple-fold.c
parenta564da506f52be66ade298b562417641e87b549f (diff)
downloadgcc-a076632e274abe344ca7648b7c7f299273d4cbe0.zip
gcc-a076632e274abe344ca7648b7c7f299273d4cbe0.tar.gz
gcc-a076632e274abe344ca7648b7c7f299273d4cbe0.tar.bz2
middle-end/100464 - avoid spurious TREE_ADDRESSABLE in folding debug stmts
canonicalize_constructor_val was setting TREE_ADDRESSABLE on bases of ADDR_EXPRs but that's futile when we're dealing with CTOR values in debug stmts. This rips out the code which was added for Java and should have been an assertion when we didn't have debug stmts. To not regress g++.dg/tree-ssa/array-temp1.C we have to adjust the testcase to not look for a no longer applied invalid optimization. 2021-05-10 Richard Biener <rguenther@suse.de> PR middle-end/100464 PR c++/100468 gcc/ * gimple-fold.c (canonicalize_constructor_val): Do not set TREE_ADDRESSABLE. gcc/cp/ * call.c (set_up_extended_ref_temp): Mark the temporary addressable if the TARGET_EXPR was. gcc/testsuite/ * gcc.dg/pr100464.c: New testcase. * g++.dg/tree-ssa/array-temp1.C: Adjust.
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r--gcc/gimple-fold.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index aa33779..768ef89 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -245,7 +245,9 @@ canonicalize_constructor_val (tree cval, tree from_decl)
if (TREE_TYPE (base) == error_mark_node)
return NULL_TREE;
if (VAR_P (base))
- TREE_ADDRESSABLE (base) = 1;
+ /* ??? We should be able to assert that TREE_ADDRESSABLE is set,
+ but since the use can be in a debug stmt we can't. */
+ ;
else if (TREE_CODE (base) == FUNCTION_DECL)
{
/* Make sure we create a cgraph node for functions we'll reference.