Commit 0a756a3f by Marek Polacek Committed by Marek Polacek

re PR c/60087 (Incorrect column number for -Wsign-compare)

	PR c/60087
c-family/
	* c-common.c (warn_for_sign_compare): Call warning_at with location
	instead of warning.
testsuite/
	* gcc.dg/pr60087.c: New test.

From-SVN: r207554
parent fdcee33b
2014-02-06 Marek Polacek <polacek@redhat.com>
PR c/60087
* c-common.c (warn_for_sign_compare): Call warning_at with location
instead of warning.
2014-02-05 Marek Polacek <polacek@redhat.com>
PR c/53123
......
......@@ -11285,8 +11285,8 @@ warn_for_sign_compare (location_t location,
if ((mask & constant) != mask)
{
if (constant == 0)
warning (OPT_Wsign_compare,
"promoted ~unsigned is always non-zero");
warning_at (location, OPT_Wsign_compare,
"promoted ~unsigned is always non-zero");
else
warning_at (location, OPT_Wsign_compare,
"comparison of promoted ~unsigned with constant");
......
2014-02-06 Marek Polacek <polacek@redhat.com>
PR c/60087
* gcc.dg/pr60087.c: New test.
2014-02-06 Alan Modra <amodra@gmail.com>
* gcc.target/powerpc/pr60032.c: New.
......
/* PR c/60087 */
/* { dg-do compile } */
/* { dg-options "-Wsign-compare" } */
void
foo (unsigned int ui, int i)
{
const unsigned char uc = 0;
_Bool b;
b = 0 != ~uc; /* { dg-warning "9:promoted ~unsigned is always non-zero" } */
b = 2 != ~uc; /* { dg-warning "9:comparison of promoted ~unsigned with constant" } */
b = uc == ~uc; /* { dg-warning "10:comparison of promoted ~unsigned with unsigned" } */
b = i == ui; /* { dg-warning "9:comparison between signed and unsigned integer expressions" } */
}
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