Given the following C code:
#include <stdint.h>
uint8_t test28(uint8_t var13, int16_t var14, uint8_t var0[2],
int32_t var19[2]) {
for (uint32_t var9 = 0; var9 < (var19[0] & var0[0] > 0); var9 += 1)
var0[0] = var13 * -(10 != var9) - var14;
return 0;
}
#ifdef HLS_FUZZER_VERIFY
constexpr
#endif
void
test_bench() {
}
int main() {}
Dynamatic fails with a verifier error during compilation:
dynamatic> set-src test28.c
dynamatic> compile
[INFO] Copied C source
/home/mboeck/dynamatic/build/bin/bug188/out/comp/test28.c:4:44: warning: & has lower precedence than >; > will be evaluated first [-Wparentheses]
4 | for (uint32_t var9 = 0; var9 < (var19[0] & var0[0] > 0); var9 += 1)
| ^~~~~~~~~~~~~
/home/mboeck/dynamatic/build/bin/bug188/out/comp/test28.c:4:44: note: place parentheses around the '>' expression to silence this warning
4 | for (uint32_t var9 = 0; var9 < (var19[0] & var0[0] > 0); var9 += 1)
| ^
| ( )
/home/mboeck/dynamatic/build/bin/bug188/out/comp/test28.c:4:44: note: place parentheses around the & expression to evaluate it first
4 | for (uint32_t var9 = 0; var9 < (var19[0] & var0[0] > 0); var9 += 1)
| ^
| ( )
1 warning generated.
[INFO] Disabled short-circuiting
/home/mboeck/dynamatic/build/bin/bug188/out/comp/test28.c:4:44: warning: & has lower precedence than >; > will be evaluated first [-Wparentheses]
4 | for (uint32_t var9 = 0; var9 < (var19[0] & var0[0] > 0); var9 += 1)
| ^~~~~~~~~~~~~
/home/mboeck/dynamatic/build/bin/bug188/out/comp/test28.c:4:44: note: place parentheses around the '>' expression to silence this warning
4 | for (uint32_t var9 = 0; var9 < (var19[0] & var0[0] > 0); var9 += 1)
| ^
| ( )
/home/mboeck/dynamatic/build/bin/bug188/out/comp/test28.c:4:44: note: place parentheses around the & expression to evaluate it first
4 | for (uint32_t var9 = 0; var9 < (var19[0] & var0[0] > 0); var9 += 1)
| ^
| ( )
1 warning generated.
[INFO] Compiled to LLVM IR
[INFO] Optimized LLVM IR
[INFO] Applied memory dependency analysis to LLVM IR
[INFO] Converted to std dialect
/home/mboeck/dynamatic/build/bin/bug188/out/comp/cf.mlir:18:10: error: operand #1 does not dominate this use
%8 = arith.muli %7, %arg0 : i8
^
/home/mboeck/dynamatic/build/bin/bug188/out/comp/cf.mlir:18:10: note: see current operation: %13 = "arith.addi"(%arg0, %16) {handshake.name = "addi1"} : (i8, i8) -> i8
/home/mboeck/dynamatic/build/bin/bug188/out/comp/cf.mlir:19:10: note: operand defined here (op in the same block)
%9 = arith.trunci %arg1 : i16 to i8
^
[FATAL] Failed to apply CF transformations
Given the following C code:
Dynamatic fails with a verifier error during compilation: