]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
verification/rvgen: Fix ltl2k writing True as a literal
authorGabriele Monaco <gmonaco@redhat.com>
Thu, 14 May 2026 15:20:48 +0000 (17:20 +0200)
committerGabriele Monaco <gmonaco@redhat.com>
Thu, 4 Jun 2026 14:44:25 +0000 (16:44 +0200)
The rvgen parser for LTL stores literal true values in the python
representation (capitalised True), this doesn't build in C.
The Literal class should already handle this case but ASTNode skips its
strigification method and converts the value (true/false) directly.

Fix by delegating ASTNode stringification to the Literal and Variable
classes instead of bypassing them.

Fixes: 97ffa4ce6ab32 ("verification/rvgen: Add support for linear temporal logic")
Reviewed-by: Nam Cao <namcao@linutronix.de>
Link: https://lore.kernel.org/r/20260514152055.229162-8-gmonaco@redhat.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
tools/verification/rvgen/rvgen/ltl2ba.py

index 7f538598a86812b80030a462eaab306e88077db7..016e7cf93bbbdd1fbf1752abee579e144ffa6188 100644 (file)
@@ -122,10 +122,8 @@ class ASTNode:
         return self.op.expand(self, node, node_set)
 
     def __str__(self):
-        if isinstance(self.op, Literal):
-            return str(self.op.value)
-        if isinstance(self.op, Variable):
-            return self.op.name.lower()
+        if isinstance(self.op, (Literal, Variable)):
+            return str(self.op)
         return "val" + str(self.id)
 
     def normalize(self):
@@ -382,6 +380,9 @@ class Variable:
     def __iter__(self):
         yield from ()
 
+    def __str__(self):
+        return self.name.lower()
+
     def negate(self):
         new = ASTNode(self)
         return NotOp(new)