Commit cb633233 by Alexandre Oliva Committed by Alexandre Oliva

[SFN] propagate single-nondebug-stmt's side effects to enclosing list

Statements without side effects, preceded by debug begin stmt markers,
would become a statement list with side effects, although the stmt on
its own would be extracted from the list and remain not having side
effects.  This causes debug info and possibly codegen differences.
This patch fixes it, identifying the situation in which the stmt would
have been extracted from the stmt list, and propagating the side
effects flag from the stmt to the list.

for  gcc/ChangeLog

	PR debug/83419
	* c-family/c-semantics.c (pop_stmt_list): Propagate side
	effects from single nondebug stmt to container list.

for  gcc/testsuite/ChangeLog

	PR debug/83419
	* gcc.dg/pr83419.c: New.

From-SVN: r255947
parent 6b6d8f38
2017-12-21 Alexandre Oliva <aoliva@redhat.com>
PR debug/83419
* c-family/c-semantics.c (pop_stmt_list): Propagate side
effects from single nondebug stmt to container list.
2017-12-21 James Greenhalgh <james.greenhalgh@arm.com>
* config/aarch64/aarch64.c (aarch64_expand_vector_init): Modify code
......@@ -96,6 +96,15 @@ pop_stmt_list (tree t)
t = l;
tsi_link_before (&i, u, TSI_SAME_STMT);
}
while (!tsi_end_p (i)
&& TREE_CODE (tsi_stmt (i)) == DEBUG_BEGIN_STMT)
tsi_next (&i);
/* If there's only one nondebug stmt in the list, we'd have
extracted the stmt and dropped the list, and we'd take
TREE_SIDE_EFFECTS from that statement, so keep the list's
TREE_SIDE_EFFECTS in sync. */
if (tsi_one_before_end_p (i))
TREE_SIDE_EFFECTS (t) = TREE_SIDE_EFFECTS (tsi_stmt (i));
}
}
......
2017-12-21 Alexandre Oliva <aoliva@redhat.com>
PR debug/83419
* gcc.dg/pr83419.c: New.
2017-12-21 James Greenhalgh <james.greenhalgh@arm.com>
* gcc.target/aarch64/vect-slp-dup.c: New.
......
/* PR debug/83419 */
/* { dg-do compile } */
/* { dg-options "-O2 -fcompare-debug" } */
int a, b;
void foo (int, ...);
void
bar (void)
{
if (a || 1 == b)
foo (1);
else
0;
foo (1, 0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment