re PR middle-end/52177 (ICE: verify_gimple failed: non-trivial conversion at assignment with __atomic_is_lock_free())

PR middle-end/52177
	* builtins.c (fold_builtin_atomic_always_lock_free,
	expand_builtin_atomic_always_lock_free,
	fold_builtin_atomic_is_lock_free,
	expand_builtin_atomic_is_lock_free): Return and/or test
	boolean_true_node/boolean_false_node instead of
	integer_one_node/integer_zero_node.

	* c-c++-common/pr52177.c: New test.

From-SVN: r184096
This commit is contained in:
Jakub Jelinek 2012-02-10 16:31:18 +01:00 committed by Jakub Jelinek
parent e6c5817dca
commit 58d38fd2d6
4 changed files with 45 additions and 7 deletions

View File

@ -1,3 +1,13 @@
2012-02-10 Jakub Jelinek <jakub@redhat.com>
PR middle-end/52177
* builtins.c (fold_builtin_atomic_always_lock_free,
expand_builtin_atomic_always_lock_free,
fold_builtin_atomic_is_lock_free,
expand_builtin_atomic_is_lock_free): Return and/or test
boolean_true_node/boolean_false_node instead of
integer_one_node/integer_zero_node.
2012-02-10 Jan Hubicka <jh@suse.cz> 2012-02-10 Jan Hubicka <jh@suse.cz>
PR middle-end/48600 PR middle-end/48600

View File

@ -5639,15 +5639,15 @@ fold_builtin_atomic_always_lock_free (tree arg0, tree arg1)
/* If the object has smaller alignment, the the lock free routines cannot /* If the object has smaller alignment, the the lock free routines cannot
be used. */ be used. */
if (type_align < mode_align) if (type_align < mode_align)
return integer_zero_node; return boolean_false_node;
/* Check if a compare_and_swap pattern exists for the mode which represents /* Check if a compare_and_swap pattern exists for the mode which represents
the required size. The pattern is not allowed to fail, so the existence the required size. The pattern is not allowed to fail, so the existence
of the pattern indicates support is present. */ of the pattern indicates support is present. */
if (can_compare_and_swap_p (mode, true)) if (can_compare_and_swap_p (mode, true))
return integer_one_node; return boolean_true_node;
else else
return integer_zero_node; return boolean_false_node;
} }
/* Return true if the parameters to call EXP represent an object which will /* Return true if the parameters to call EXP represent an object which will
@ -5671,7 +5671,7 @@ expand_builtin_atomic_always_lock_free (tree exp)
} }
size = fold_builtin_atomic_always_lock_free (arg0, arg1); size = fold_builtin_atomic_always_lock_free (arg0, arg1);
if (size == integer_one_node) if (size == boolean_true_node)
return const1_rtx; return const1_rtx;
return const0_rtx; return const0_rtx;
} }
@ -5686,8 +5686,8 @@ fold_builtin_atomic_is_lock_free (tree arg0, tree arg1)
return NULL_TREE; return NULL_TREE;
/* If it isn't always lock free, don't generate a result. */ /* If it isn't always lock free, don't generate a result. */
if (fold_builtin_atomic_always_lock_free (arg0, arg1) == integer_one_node) if (fold_builtin_atomic_always_lock_free (arg0, arg1) == boolean_true_node)
return integer_one_node; return boolean_true_node;
return NULL_TREE; return NULL_TREE;
} }
@ -5717,7 +5717,7 @@ expand_builtin_atomic_is_lock_free (tree exp)
/* If the value is known at compile time, return the RTX for it. */ /* If the value is known at compile time, return the RTX for it. */
size = fold_builtin_atomic_is_lock_free (arg0, arg1); size = fold_builtin_atomic_is_lock_free (arg0, arg1);
if (size == integer_one_node) if (size == boolean_true_node)
return const1_rtx; return const1_rtx;
return NULL_RTX; return NULL_RTX;

View File

@ -1,3 +1,8 @@
2012-02-10 Jakub Jelinek <jakub@redhat.com>
PR middle-end/52177
* c-c++-common/pr52177.c: New test.
2012-02-10 Jan Hubicka <jh@suse.cz> 2012-02-10 Jan Hubicka <jh@suse.cz>
PR middle-end/48600 PR middle-end/48600

View File

@ -0,0 +1,23 @@
/* PR middle-end/52177 */
/* { dg-do compile } */
/* { dg-options "-O -fno-tree-ccp" } */
int *s;
static inline int
foo ()
{
return sizeof (int);
}
int
bar ()
{
return __atomic_always_lock_free (foo (), s);
}
int
baz ()
{
return __atomic_is_lock_free (foo (), s);
}