A couple of bootstrap issues on some targets:
68346: My earlier change to avoid folding the arguments to
warn_tautological_cmp wasn't quite right, either. This patch folds
within the function, at the place where we are interested in a constant
value.
68361: The way we were trying to suppress -Wparentheses before wasn't
effective enough. Let's actually turn off the flag around the relevant
convert call.
Tested x86_64-pc-linux-gnu, applying to trunk.
commit 56ca181e3d438fb9b95c865fde6e77f5335c791a
Author: Jason Merrill <ja...@redhat.com>
Date: Tue Nov 17 10:51:24 2015 -0500
PR bootstrap/68361
* cvt.c (cp_convert_and_check): Use warning_sentinel to suppress
-Wparentheses.
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 0231efc..ebca004 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -644,7 +644,7 @@ cp_convert_and_check (tree type, tree expr, tsubst_flags_t complain)
else
{
/* Avoid bogus -Wparentheses warnings. */
- TREE_NO_WARNING (folded) = true;
+ warning_sentinel w (warn_parentheses);
folded_result = cp_convert (type, folded, tf_none);
}
folded_result = fold_simple (folded_result);
diff --git a/gcc/testsuite/g++.dg/warn/Wparentheses-28.C b/gcc/testsuite/g++.dg/warn/Wparentheses-28.C
new file mode 100644
index 0000000..f6636cb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wparentheses-28.C
@@ -0,0 +1,14 @@
+// PR bootstrap/68361
+// { dg-options -Wparentheses }
+
+struct A
+{
+ int p: 2;
+};
+
+A a, b;
+
+int main()
+{
+ bool t = (a.p = b.p);
+}
commit 7489a9400cffa4c1010debaf2d86dcd286ce1cfd
Author: Jason Merrill <ja...@redhat.com>
Date: Tue Nov 17 12:56:00 2015 -0500
PR bootstrap/68346
* c-common.c (warn_tautological_cmp): Fold before checking for
constants.
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 06d857c..f50ca48 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -1924,7 +1924,7 @@ warn_tautological_cmp (location_t loc, enum tree_code code, tree lhs, tree rhs)
/* We do not warn for constants because they are typical of macro
expansions that test for features, sizeof, and similar. */
- if (CONSTANT_CLASS_P (lhs) || CONSTANT_CLASS_P (rhs))
+ if (CONSTANT_CLASS_P (fold (lhs)) || CONSTANT_CLASS_P (fold (rhs)))
return;
/* Don't warn for e.g.
diff --git a/gcc/testsuite/g++.dg/warn/Wtautological-compare2.C b/gcc/testsuite/g++.dg/warn/Wtautological-compare2.C
new file mode 100644
index 0000000..9d9060d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wtautological-compare2.C
@@ -0,0 +1,11 @@
+// PR bootstrap/68346
+// { dg-options -Wtautological-compare }
+
+#define INVALID_REGNUM (~(unsigned int) 0)
+#define PIC_OFFSET_TABLE_REGNUM INVALID_REGNUM
+
+int main()
+{
+ if ((unsigned) PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM)
+ __builtin_abort();
+}