tmmark: verify_ssa failed [PR95569]

This patch fixes a latent bug exposed by eb72dc663e.
See the discussion on the bug for details.

Bootstrapped and regtested on aarch64-linux-gnu. No new fails introduced.

2020-06-10  Qian Chao  <qianchao9@huawei.com>

gcc/ChangeLog:

	PR tree-optimization/95569
	* trans-mem.c (expand_assign_tm): Ensure that rtmp is marked TREE_ADDRESSABLE.

gcc/testsuite/ChangeLog:

	PR tree-optimization/95569
	* gcc.dg/tm/pr95569.c: New test.
This commit is contained in:
Qian Chao 2020-06-10 04:46:56 -04:00 committed by Martin Liska
parent dc6d15eaa2
commit 6d9ef0621f
No known key found for this signature in database
GPG Key ID: 4DC182DC0FA73785
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,18 @@
/* { dg-do compile } */
/* { dg-options "-fgnu-tm -O0" } */
/* { dg-do compile { target aarch64*-*-* } } */
typedef int __attribute__ ((vector_size (16))) vectype;
vectype v;
void
foo (int c)
{
vectype *p = __builtin_malloc (sizeof (vectype));
__transaction_atomic
{
*p = v;
if (c)
__transaction_cancel;
}
}

View File

@ -2424,6 +2424,7 @@ expand_assign_tm (struct tm_region *region, gimple_stmt_iterator *gsi)
if (is_gimple_reg (rhs))
{
tree rtmp = create_tmp_var (TREE_TYPE (rhs));
TREE_ADDRESSABLE (rtmp) = 1;
rhs_addr = build_fold_addr_expr (rtmp);
gcall = gimple_build_assign (rtmp, rhs);
gsi_insert_before (gsi, gcall, GSI_SAME_STMT);