PR 61713: ICE when expanding single-threaded version of atomic_test_and_set.

PR target/61713
	* gcc/optabs.c (expand_atomic_test_and_set): Do not try to emit
	move to subtarget in serial version if result is ignored.

	PR target/61713
	* gcc.dg/pr61756.c: New test.

From-SVN: r213555
This commit is contained in:
Kyrylo Tkachov 2014-08-04 10:03:32 +00:00 committed by Kyrylo Tkachov
parent 6d0b56ad0c
commit 0d03cda4fc
4 changed files with 30 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2014-08-04 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR target/61713
* gcc/optabs.c (expand_atomic_test_and_set): Do not try to emit
move to subtarget in serial version if result is ignored.
2014-07-14 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
Kyrylo Tkachov <kyrylo.tkachov@arm.com>

View File

@ -7356,7 +7356,10 @@ expand_atomic_test_and_set (rtx target, rtx mem, enum memmodel model)
perform the operation. */
if (!ret)
{
emit_move_insn (subtarget, mem);
/* If the result is ignored skip the move to target. */
if (subtarget != const0_rtx)
emit_move_insn (subtarget, mem);
emit_move_insn (mem, trueval);
ret = subtarget;
}

View File

@ -1,3 +1,8 @@
2014-08-04 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR target/61713
* gcc.dg/pr61756.c: New test.
2014-08-04 Tom de Vries <tom@codesourcery.com>
* gcc.dg/cproj-fails-with-broken-glibc.c: Use xfail for broken glibc

View File

@ -0,0 +1,15 @@
/* PR target/61756 */
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-options "-O2 -march=armv5" { target arm*-*-* } } */
#include <stdatomic.h>
static volatile atomic_flag guard = ATOMIC_FLAG_INIT;
void
try_atomic_flag_test_and_set (void)
{
atomic_flag_test_and_set (&guard);
}