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 end...



details:   https://anonhg.NetBSD.org/src/rev/3e8c81f584fe
branches:  trunk
changeset: 953817:3e8c81f584fe
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Mar 21 12:19:36 2021 +0000

description:
tests/lint: demonstrate bug in endless loop detection

diffstat:

 tests/usr.bin/xlint/lint1/msg_217.c   |  22 +++++++++++++++++++++-
 tests/usr.bin/xlint/lint1/msg_217.exp |   2 ++
 2 files changed, 23 insertions(+), 1 deletions(-)

diffs (40 lines):

diff -r ba1fa32d549e -r 3e8c81f584fe tests/usr.bin/xlint/lint1/msg_217.c
--- a/tests/usr.bin/xlint/lint1/msg_217.c       Sun Mar 21 12:10:27 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_217.c       Sun Mar 21 12:19:36 2021 +0000
@@ -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 @@
 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 */
diff -r ba1fa32d549e -r 3e8c81f584fe tests/usr.bin/xlint/lint1/msg_217.exp
--- a/tests/usr.bin/xlint/lint1/msg_217.exp     Sun Mar 21 12:10:27 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_217.exp     Sun Mar 21 12:19:36 2021 +0000
@@ -1,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]



Home | Main Index | Thread Index | Old Index