Hi, I tried checking the program for undefined behavior using Valgrind as : $ valgrind --leak-check=yes ./a.out $ valgrind --track-origins=yes ./a.out where a.out is the executable for wrong.c file compiled using : clang -g -O1 wrong4.c -o a.out following the steps at: http://valgrind.org/docs/manual/quick-start.html#quick-start.intro The image below consists of the output of valgrind. Please can you verify the output in the image ? If everything is correct, this leads me to suspect that there could be a bug in clang, if so, can I use creduce to reduce the bug or do I need to use bugpoint mentioned at http://llvm.org/docs/HowToSubmitABug.html#miscompiling Thanks, Sameeran Joshi On 1/25/19, John Regehr <regehr@cs.utah.edu> wrote: > Yes, this is either a wrong code bug in clang or else a bug where Csmith > emitted an insufficiently defined program, you'll need to determine > which of these is the case. > > Also I'm confused about why gcc and clang would return different results > -- generally they make the same decisions for implementation-defined > behaviors. This is worth investigating as well. > > John > > > On 1/25/19 3:56 AM, sameeran joshi wrote: >> Hi, >> compiling a program as >> gcc -O0 --------> CHECKSUM : 72D53249 >> gcc -O1 --------> CHECKSUM : 72D53249 >> gcc -O2 --------> CHECKSUM : 72D53249 >> gcc -O3 --------> CHECKSUM : 72D53249 >> gcc -Os --------> CHECKSUM : 72D53249 >> gcc -Ofast --------> CHECKSUM : 72D53249 >> >> **clang -O0 --------> CHECKSUM : 2873C061**(differs) >> >> clang -O1 --------> CHECKSUM : 10301700 >> clang -O2 --------> CHECKSUM : 10301700 >> clang -O3 --------> CHECKSUM : 10301700 >> clang -Os --------> CHECKSUM : 10301700 >> clang -Ofast --------> CHECKSUM : 10301700 >> >> is this a wrong code bug found using differential testing approach? >> Thanks, >> Sameeran Joshi >> >
Attachment:
memcheck_valgrind.png
Description: PNG image