@@ -1,4 +1,4 @@
-/* $NetBSD: msg_169.c,v 1.2 2021/01/04 15:52:51 rillig Exp $ */
+/* $NetBSD: msg_169.c,v 1.3 2021/01/04 22:41:56 rillig Exp $ */
# 3 "msg_169.c"
// Test for message: precedence confusion possible: parenthesize! [169]
@@ -146,5 +146,6 @@
ok = a + b * c;
}
-// TODO: add a test with unsigned long instead of unsigned, to demonstrate
+// TODO: add a test with unsigned long instead of unsigned, trying to
-// that the typo in
+// demonstrate that the typo in check_precedence_confusion actually has an
+// effect.
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.128 2021/01/04 22:33:47 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.129 2021/01/04 22:41:56 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.128 2021/01/04 22:33:47 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.129 2021/01/04 22:41:56 rillig Exp $");
#endif
#include <float.h>
@@ -4016,6 +4016,19 @@
* Before fixing this though, there should be a unit test
* that demonstrates an actual change in behavior when this
* bug gets fixed.
+ *
+ * Right now, the condition is always false. To make it true
+ * after fixing the typo, the right-hand operand must be an
+ * explicit cast or an implicit conversion that is
+ * parenthesized. For the right-hand operand itself, this
+ * would already be done using the line below the loop.
+ *
+ * To make a difference, the right-hand operand must not be
+ * parenthesized, but its indirect cast or conversion must be.
+ *
+ * An implicit conversion is never parenthesized. Therefore
+ * this must be a cast that is later converted, to build a
+ * chain.
*/
for (rn = tn->tn_right; tn->tn_op == CVT; rn = rn->tn_left)
rparn |= rn->tn_parenthesized;