Commit 802b38c9 by Jakub Jelinek Committed by Jakub Jelinek

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
parent a6a5091a
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> 2017-10-06 Jakub Jelinek <jakub@redhat.com>
PR c/82437 PR c/82437
......
...@@ -362,8 +362,8 @@ warn_tautological_bitwise_comparison (location_t loc, tree_code code, ...@@ -362,8 +362,8 @@ warn_tautological_bitwise_comparison (location_t loc, tree_code code,
int prec = MAX (TYPE_PRECISION (TREE_TYPE (cst)), int prec = MAX (TYPE_PRECISION (TREE_TYPE (cst)),
TYPE_PRECISION (TREE_TYPE (bitopcst))); TYPE_PRECISION (TREE_TYPE (bitopcst)));
wide_int bitopcstw = wide_int::from (bitopcst, prec, UNSIGNED); wide_int bitopcstw = wi::to_wide (bitopcst, prec);
wide_int cstw = wide_int::from (cst, prec, UNSIGNED); wide_int cstw = wi::to_wide (cst, prec);
wide_int res; wide_int res;
if (TREE_CODE (bitop) == BIT_AND_EXPR) if (TREE_CODE (bitop) == BIT_AND_EXPR)
......
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> 2017-10-10 Bin Cheng <bin.cheng@arm.com>
* gcc.dg/tree-ssa/ldist-34.c: New test. * gcc.dg/tree-ssa/ldist-34.c: New test.
......
/* 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;
}
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