Module Name:    src
Committed By:   rillig
Date:           Sun Mar 21 12:19:37 UTC 2021

Modified Files:
        src/tests/usr.bin/xlint/lint1: msg_217.c msg_217.exp

Log Message:
tests/lint: demonstrate bug in endless loop detection


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_217.c
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_217.exp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_217.c
diff -u src/tests/usr.bin/xlint/lint1/msg_217.c:1.6 src/tests/usr.bin/xlint/lint1/msg_217.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_217.c:1.6	Sun Mar 21 11:55:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_217.c	Sun Mar 21 12:19:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_217.c,v 1.6 2021/03/21 11:55:59 rillig Exp $	*/
+/*	$NetBSD: msg_217.c,v 1.7 2021/03/21 12:19:36 rillig Exp $	*/
 # 3 "msg_217.c"
 
 // Test for message: function %s falls off bottom without returning value [217]
@@ -46,3 +46,23 @@ int
 main(void)
 {
 }
+
+int
+reachable_continue_leads_to_endless_loop(void)
+{
+	for (;;) {
+		if (1)
+			continue;
+		break;
+	}
+}				/* FIXME *//* expect: 217 */
+
+int
+unreachable_continue_falls_through(void)
+{
+	for (;;) {
+		if (0)
+			continue;
+		break;
+	}
+}				/* expect: 217 */

Index: src/tests/usr.bin/xlint/lint1/msg_217.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_217.exp:1.5 src/tests/usr.bin/xlint/lint1/msg_217.exp:1.6
--- src/tests/usr.bin/xlint/lint1/msg_217.exp:1.5	Sun Mar 21 11:55:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_217.exp	Sun Mar 21 12:19:36 2021
@@ -1 +1,3 @@
 msg_217.c(11): warning: function random falls off bottom without returning value [217]
+msg_217.c(58): warning: function reachable_continue_leads_to_endless_loop falls off bottom without returning value [217]
+msg_217.c(68): warning: function unreachable_continue_falls_through falls off bottom without returning value [217]

Reply via email to