[K-Bug] The LLVM backend ignores rule priorities

Open
#4,676 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
linux
Domain
compilers

Research direction

Start with the minimal definition in a.k and input in a.in, then run kompile followed by krun to reproduce the LLVM backend result. Compare the priority and requires cases described in the issue; done means both produce b rather than c and neither enters an infinite loop.

Written by the indexing model from the issue text.

Description

What component is the issue in?

llvm-backend

Which command
  • kompile
  • kast
  • krun
  • kprove
  • kprovex
  • ksearch
What K Version?

v7.1.164-0-g459fdd7b84

Operating System

Linux

K Definitions (If Possible)

a.k:

module A
  imports K-EQUAL-SYNTAX

  syntax Stuff ::= "a" | "b" | "c"

  rule A:Stuff => b requires A ==K a [priority(10)]
  rule a => c

endmodule
Steps to Reproduce

use this a.in file:

a

Then, kompile a.k && krun a.in produces

<k>
  c ~> .K
</k>

This is wrong, it should have produced b instead of c.

A few more notes:
Commenting out rule a => c produces b as a result. Removing the requires clause from rule A:Stuff => b requires A ==K a makes the backend enter an infinite loop. Replacing the same rule with rule a => b, while keeping the priority produces the expected result.

Expected Results

The command above should have produced this (both in the main case described above and in the infinite loop one):

<k>
  b ~> .K
</k>
Dominant language
Python
Stars
591
Forks
163
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from runtimeverification/k

All issues in runtimeverification/k

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.