From d3c92d32ba1cb9b482fd4ef6e4cb0ca83f6a9e20 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 20 Jan 2021 19:03:44 -0500 Subject: [PATCH] pan/bi: Lint for infinite loops I would make this unconditional, but conditionally branching to the same clause in a tight loop is (disturbingly) legal, as far as I know. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Boris Brezillon Part-of: --- src/panfrost/bifrost/disassemble.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/panfrost/bifrost/disassemble.c b/src/panfrost/bifrost/disassemble.c index 9858001c06e..c09bc3861df 100644 --- a/src/panfrost/bifrost/disassemble.c +++ b/src/panfrost/bifrost/disassemble.c @@ -279,6 +279,11 @@ dump_pc_imm(FILE *fp, uint64_t imm, enum bi_constmod mod, bool high32) if (mod == BI_CONSTMOD_PC_LO && high32) fprintf(fp, " >> 32"); + + /* While technically in spec, referencing the current clause as (pc + + * 0) likely indicates an unintended infinite loop */ + if (offs == 0) + fprintf(fp, " /* XXX: likely an infinite loop */"); } /* Convert an index to an embedded constant in FAU-RAM to the index of the