Open Jiahui17 opened 3 months ago
Thanks for the report. I diagnosed the problem and unfortunately it is a mean one I do not have time to fix right now.
The issue is in our semi-custom ScfToCf
conversion pass. When lowering for loops we have an optimization that upgrades the iterator's normal signed comparison (slt
) to an unsigned comparison (ult
) when our heuristic detects that both the iterator and bound are necessarily positive (see here). We do this because it allows us to perform more aggressive bitwidth optimizations down in Handshake. Unfortunately it looks like our heuristic is faulty and in that case incorrectly upgrades the innermost loop's comparator from signed to unsigned, when the upper bound (j - 1
) can in fact be negative. This makes the cf-level simulator interprets the bound as unsigned when it is negative, so it becomes a very large number that overflows the A
array.
Benchmark:
symm_float.c
Script:
Error:
Note that the source program can be compiled and ran by
g++
without any error