Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/usr.bin/xlint/lint1 tests/lint: demonstrate bug in cha...
details: https://anonhg.NetBSD.org/src/rev/ae96ad763831
branches: trunk
changeset: 984865:ae96ad763831
user: rillig <rillig%NetBSD.org@localhost>
date: Mon Jul 26 17:09:46 2021 +0000
description:
tests/lint: demonstrate bug in chained assignment (since 2021-07-15)
Since cgram.y 1.325 from 2021-07-15, lint has been parsing assignment
expressions correctly. It got the associativity wrong.
diffstat:
tests/usr.bin/xlint/lint1/expr_precedence.c | 14 +++++++++++++-
tests/usr.bin/xlint/lint1/expr_precedence.exp | 1 +
2 files changed, 14 insertions(+), 1 deletions(-)
diffs (33 lines):
diff -r a639747bebab -r ae96ad763831 tests/usr.bin/xlint/lint1/expr_precedence.c
--- a/tests/usr.bin/xlint/lint1/expr_precedence.c Mon Jul 26 16:45:56 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/expr_precedence.c Mon Jul 26 17:09:46 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: expr_precedence.c,v 1.3 2021/07/15 17:48:10 rillig Exp $ */
+/* $NetBSD: expr_precedence.c,v 1.4 2021/07/26 17:09:46 rillig Exp $ */
# 3 "expr_precedence.c"
/*
@@ -36,3 +36,15 @@
/* Syntactically ok, must be a constant expression though. */
var > 0 ? 2 : 1)))
my_printf(const char *, ...);
+
+void
+assignment_associativity(int arg)
+{
+ int left, right;
+
+ /* FIXME */
+ /* expect+1: error: left operand of '=' must be lvalue [114] */
+ left = right = arg;
+
+ left = arg;
+}
diff -r a639747bebab -r ae96ad763831 tests/usr.bin/xlint/lint1/expr_precedence.exp
--- a/tests/usr.bin/xlint/lint1/expr_precedence.exp Mon Jul 26 16:45:56 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/expr_precedence.exp Mon Jul 26 17:09:46 2021 +0000
@@ -2,3 +2,4 @@
expr_precedence.c(18): error: non-constant initializer [177]
expr_precedence.c(35): error: 'var' undefined [99]
expr_precedence.c(35): error: syntax error '=' [249]
+expr_precedence.c(47): error: left operand of '=' must be lvalue [114]
Home |
Main Index |
Thread Index |
Old Index