+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
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.
--- /dev/null
+/* 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" } */
+}