testbench generation error with clang12
SerenaC94 opened this issue · comments
bambu test_issue.c --top-fname=test_function --simulate --generate-tb=test.xml --compiler=I386_CLANG10 -v4
-> synthesis and simulation work fine
bambu test_issue.c --top-fname=test_function --simulate --generate-tb=test.xml --compiler=I386_CLANG12 -v4
-> testbench generation fails with the following error:
C-based testbench generation for function test_function: /files0/extended/curz959/issue_panda/HLS_output//simulation/values.c
error -> Unexpected nested initialization tree_reindex - Current status is tree_reindex[0]:tree_reindex[0]
All files attached in clang12.zip.
I am using bambu version afa0801-dev/panda.
Still broken as of today, Bambu version 6410712-dev/panda
The reported behaviour is due to the use of flexible array members (FAM) which implies a different implementation with respect to the standard array definition, thus the provided initialization is not valid any more for the underlaying data type generated from the compiler.
A simple workaround to fix this in the provided code is to replace the P definition with a preprocessor define, so that a simple multi-dimensional array pointer is generated. This way the inititialization style provided in the test.xml file should be fine.