Commit 7d9cf801 by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/77624 (ICE on x86_64-linux-gnu (internal compiler error: in…

re PR middle-end/77624 (ICE on x86_64-linux-gnu (internal compiler error: in fold_builtin_atomic_always_lock_free, at builtins.c:5583))

	PR middle-end/77624
	* builtins.c (fold_builtin_atomic_always_lock_free): Only look through
	cast to void * if the cast is from some other pointer type.

	* c-c++-common/pr77624-1.c: New test.
	* c-c++-common/pr77624-2.c: New test.

From-SVN: r240263
parent 3aebb6ff
2016-09-20 Jakub Jelinek <jakub@redhat.com>
PR middle-end/77624
* builtins.c (fold_builtin_atomic_always_lock_free): Only look through
cast to void * if the cast is from some other pointer type.
2016-09-20 Richard Biener <rguenther@suse.de>
PR tree-optimization/77646
......
......@@ -5575,8 +5575,10 @@ fold_builtin_atomic_always_lock_free (tree arg0, tree arg1)
end before anything else has a chance to look at it. The pointer
parameter at this point is usually cast to a void *, so check for that
and look past the cast. */
if (CONVERT_EXPR_P (arg1) && POINTER_TYPE_P (ttype)
&& VOID_TYPE_P (TREE_TYPE (ttype)))
if (CONVERT_EXPR_P (arg1)
&& POINTER_TYPE_P (ttype)
&& VOID_TYPE_P (TREE_TYPE (ttype))
&& POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (arg1, 0))))
arg1 = TREE_OPERAND (arg1, 0);
ttype = TREE_TYPE (arg1);
......
2016-09-20 Jakub Jelinek <jakub@redhat.com>
PR middle-end/77624
* c-c++-common/pr77624-1.c: New test.
* c-c++-common/pr77624-2.c: New test.
2016-09-20 Andre Vehreschild <vehre@gcc.gnu.org>
* gfortran.dg/coarray_allocate_7.f08: Using + instead of fixed number
......
/* PR middle-end/77624 */
/* { dg-do compile } */
int
foo (int a)
{
return __atomic_is_lock_free (2, a); /* { dg-warning "pointer from integer" "" { target c } } */
} /* { dg-error "invalid conversion" "" { target c++ } 7 } */
int
bar (int a)
{
return __atomic_always_lock_free (2, a); /* { dg-warning "pointer from integer" "" { target c } } */
} /* { dg-error "invalid conversion" "" { target c++ } 13 } */
/* PR middle-end/77624 */
/* { dg-do compile } */
void
foo (int *a)
{
double b = 0;
__atomic_is_lock_free (2, a, 2); /* { dg-error "too many arguments" } */
__atomic_is_lock_free (2); /* { dg-error "too few arguments" } */
__atomic_is_lock_free (2, b); /* { dg-error "incompatible type" "" { target c } } */
/* { dg-message "expected" "" { target c } 10 } */
/* { dg-error "convert" "" { target c++ } 10 } */
__atomic_is_lock_free (2, 0);
}
void
bar (int *a)
{
double b = 0;
__atomic_always_lock_free (2, a, 2); /* { dg-error "too many arguments" } */
__atomic_always_lock_free (2); /* { dg-error "too few arguments" } */
__atomic_always_lock_free (2, b); /* { dg-error "incompatible type" "" { target c } } */
/* { dg-message "expected" "" { target c } 22 } */
/* { dg-error "convert" "" { target c++ } 22 } */
__atomic_always_lock_free (2, 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