[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [creduce-dev] [EXTERNAL] creduce with yarpgen



To enforce things like that, I usually add a step to my “interesting” test that validates the code compiles correctly with known good tools, and if you want to enforce exacting text add an invocation of grep to the test. That way you can make the test “fail” if grep produces no matches, ie that you require a certain string to exist in the reduced code.

 

Schwieb

 

From: creduce-dev-bounces@flux.utah.edu <creduce-dev-bounces@flux.utah.edu> On Behalf Of Alessandro Mantovani
Sent: Friday, June 2, 2023 2:21 AM
To: creduce-dev@flux.utah.edu
Subject: [EXTERNAL] [creduce-dev] creduce with yarpgen

 

Dear all,

 

I am using C-reduce to reduce some C testcases produced by yarpgen, that result in miscompilations, i.e., my target compiler (clang based) produces two binaries, respectively with "O0" and "O3", that, when executed, output a different result of the checksum. 

 

I have written an interestingness test that looks quite complete to me. Basically, I started with the one suggested on the C-reduce webpage (https://embed.cs.utah.edu/creduce/using/wrong1/test1.sh) and then added a compilation stage with asan, ubsan and msan (for both the "O0" and "O3" optimization levels). I also have tried by enabling the flag "-Werror=uninitialized", even if it could be redundant, as I have msan.

 

The command line that I use then is simply:

creduce ./test_interestingness.sh driver.c func.c init.h

where driver.c, func.c and init.h are the files generated by yarpgen.

 

That said, the problem I face is that when C-reduce ends its job I obtain two reduced driver.c and func.c files where the test() function invocation is messed up. Usually in the driver.c it is declared with the following signature:

 

void test()

 

and then invoked in the driver.c itself with a certain number N of parameters. Surprisingly, at least for me, in the func.c file, the same test() function is invoked with a number M of parameters where N != M.   

 

I have to underline that I am testing the arm backend of the compiler and thus, the elf binaries I obtain need to run on an Aarch64 emulator, while the sanitized versions of the same code (asan,ubsan,msan) run on x86. I attach in the current email the interestingness script and the reduced testcases I obtain. If you want to generate the original yarpgen testcases, the yarpgen version is :

 

yarpgen version 2.0 (build fc8851a on 2022:10:30)

 

invoked with the --std=c flag and the seed is 2149690884. Unfortunately I cannot share the target compiler as it is private, sorry for that. Is there any additional check or flag I can add to my interestingness test to enforce the fact that the test() function should be declared and invoked coherently ? 

 

Best Regards,

 

Alessandro