re PR c/82437 (false-positive -Wtautological-compare warning with -std=gnu89)

PR c/82437
	* c-warn.c (warn_tautological_bitwise_comparison): Use wi::to_wide
	instead of wide_int::from.

	* c-c++-common/Wtautological-compare-7.c: New test.

From-SVN: r253589
This commit is contained in:
Jakub Jelinek 2017-10-10 18:17:47 +02:00 committed by Jakub Jelinek
parent a6a5091a56
commit 802b38c91f
4 changed files with 24 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2017-10-10 Jakub Jelinek <jakub@redhat.com>
PR c/82437
* c-warn.c (warn_tautological_bitwise_comparison): Use wi::to_wide
instead of wide_int::from.
2017-10-06 Jakub Jelinek <jakub@redhat.com>
PR c/82437

View file

@ -362,8 +362,8 @@ warn_tautological_bitwise_comparison (location_t loc, tree_code code,
int prec = MAX (TYPE_PRECISION (TREE_TYPE (cst)),
TYPE_PRECISION (TREE_TYPE (bitopcst)));
wide_int bitopcstw = wide_int::from (bitopcst, prec, UNSIGNED);
wide_int cstw = wide_int::from (cst, prec, UNSIGNED);
wide_int bitopcstw = wi::to_wide (bitopcst, prec);
wide_int cstw = wi::to_wide (cst, prec);
wide_int res;
if (TREE_CODE (bitop) == BIT_AND_EXPR)

View file

@ -1,3 +1,8 @@
2017-10-10 Jakub Jelinek <jakub@redhat.com>
PR c/82437
* c-c++-common/Wtautological-compare-7.c: New test.
2017-10-10 Bin Cheng <bin.cheng@arm.com>
* gcc.dg/tree-ssa/ldist-34.c: New test.

View file

@ -0,0 +1,11 @@
/* PR c/82437 */
/* { dg-do compile { target int32 } } */
/* { dg-options "-Wtautological-compare" } */
int
foo (unsigned long long int x)
{
if ((x | 0x190000000ULL) != -1879048192) /* { dg-bogus "bitwise comparison always evaluates to" } */
return 0;
return 1;
}