tests failed
Closed this issue · 11 comments
Followed above process of executing.All tests failed.Why?
Attached errors getting as error.pdf
error.pdf
I can confirm this problem. I can reproduce it on Ubuntu 22.04 with clang compiler.
The problem is that the tests are compiled with -g
and therefore llvm2c
attempts to reconstruct names of variables and it generates code like this:
int main(int argc, char** argv){
unsigned int var2;
unsigned int argc;
unsigned char** argv;
unsigned char* p;
unsigned long num;
struct s_test arr[5];
unsigned int i;
unsigned int sum;
unsigned int i2;
block0:
var2 = 0;
argc = argc;
argv = argv;
Without debugging information, it generates code like this, which is fine:
int main(int argc, char** argv){
unsigned int var2;
unsigned int var3;
unsigned char** var4;
unsigned char* var5;
unsigned long var6;
struct s_test var7[5];
unsigned int var8;
unsigned int var9;
unsigned int var10;
block0:
var2 = 0;
var3 = argc;
var4 = argv;
To be more precise, the problem is not that the tests are compiled with -g
, but that apparently there is a bug in using the names of arguments from debugging information.
This commit should fix that: vmihalko@72a0889 but either c++17
is needed (https://github.com/staticafi/llvm2c/blob/master/CMakeLists.txt#L23) or rewrite std::find_if
into a range-based for loop.
Does the above modification solves issue?
yes.
I made the update as C++17,but the issue persists for me,why?
Did you update to C++17 with the abovementioned change (find_if
) and rebuild the whole project?
yes I have made both the changes.I had a doubt whether my range based loop is correct or not,could you please provide snippet for the same.