re PR middle-end/86202 (ICE in get_range_info calling an invalid memcpy() declaration)

PR middle-end/86202
	* gimple-fold.c (size_must_be_zero_p): Check the type of the size.

	* gcc.dg/Wint-conversion-2.c: New test.

From-SVN: r262344
This commit is contained in:
Marek Polacek 2018-07-03 14:21:15 +00:00 committed by Marek Polacek
parent 2831d6814a
commit 3f27391f45
4 changed files with 22 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2018-07-03 Marek Polacek <polacek@redhat.com>
PR middle-end/86202
* gimple-fold.c (size_must_be_zero_p): Check the type of the size.
2018-07-03 Richard Biener <rguenther@suse.de>
PR ipa/86389

View File

@ -645,7 +645,7 @@ size_must_be_zero_p (tree size)
if (integer_zerop (size))
return true;
if (TREE_CODE (size) != SSA_NAME)
if (TREE_CODE (size) != SSA_NAME || !INTEGRAL_TYPE_P (TREE_TYPE (size)))
return false;
wide_int min, max;

View File

@ -1,3 +1,8 @@
2018-07-03 Marek Polacek <polacek@redhat.com>
PR middle-end/86202
* gcc.dg/Wint-conversion-2.c: New test.
2018-07-03 Richard Biener <rguenther@suse.de>
PR ipa/86389

View File

@ -0,0 +1,11 @@
/* PR middle-end/86202 */
/* { dg-do compile } */
/* { dg-options "-Wint-conversion" } */
void *memcpy (void *, void *, __SIZE_TYPE__ *);
void *a, *b;
void f (void)
{
long unsigned int c = 0;
memcpy (a, b, c); /* { dg-warning "passing argument" } */
}