runtimeverification / runtimeverification/llvm-backend
LLVM backend failing to evaluate function
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 43
- Forks
- 22
- PR merge metrics
- No merged PRs in 30d
Description
For the example below, the LLVM backend ends execution with an error, outputting an unevaluated function, without any obvious reason for not evaluating it.
[Error] krun: ./a-kompiled/interpreter
/tmp/.krun-2023-06-26-17-49-17-Oq7lqoxprx/tmp.in.zDrsIYS8SO -1
/tmp/.krun-2023-06-26-17-49-17-Oq7lqoxprx/result.kore
g ( ListItem ( wrap ( b"a" ) ) )
All or most of the elements in the semantics below seem to be needed for reproducing the issue (e.g. using a normal Map, or passing a list directly to g, without producing it with Set2List(keys(...)) do not generate the error above).
To reproduce:
a.k
module A
imports BYTES
imports COLLECTIONS
imports K-EQUAL-SYNTAX
imports LIST
syntax List ::= f ( MapBytesToBytes ) [function, symbol, klabel(myF)]
| g ( List ) [function, symbol, klabel(myG)]
rule f(M) => g(Set2List(keys(M)))
rule g(.List) => .List
rule g(ListItem(_:WrappedBytes) L:List) => g(L:List)
syntax KItem ::= a(MapBytesToBytes)
| b(List)
rule a(M) => b(f(M))
syntax WrappedBytes ::= wrap(Bytes) [symbol, klabel(wrapBytes)]
syntax MapBytesToBytes [hook(MAP.Map)]
syntax MapBytesToBytes ::= MapBytesToBytes MapBytesToBytes
[ left, function, hook(MAP.concat), klabel(_MapBytesToBytes_),
symbol, assoc, comm, unit(.MapBytesToBytes), element(_Bytes2Bytes|->_),
index(0), format(%1%n%2)
]
syntax MapBytesToBytes ::= ".MapBytesToBytes"
[ function, total, hook(MAP.unit),
klabel(.MapBytesToBytes), symbol, latex(\dotCt{MapBytesToBytes})
]
syntax MapBytesToBytes ::= WrappedBytes "Bytes2Bytes|->" WrappedBytes
[ function, total, hook(MAP.element),
klabel(_Bytes2Bytes|->_), symbol,
latex({#1}\mapsto{#2}), injective
]
syntax Set ::= keys(MapBytesToBytes) [function, total, hook(MAP.keys)]
endmodule
start:
a(wrap(b"a") Bytes2Bytes|-> wrap(b"b"))
command line:
kompile a.k --backend llvm && krun start
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproducer in a.k and run kompile a.k --backend llvm && krun start to observe the unevaluated function. Trace the LLVM backend handling of Set2List(keys(M)) and the g rules; done means the example evaluates to .List without the reported error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100