> a;
> main() {
> a = 0x7D393Ep69;
> printf(a);
> }
> How do I ensure it is a wrong code bug ?
This is definitely not a compiler bug, but rather undefined behavior,
since an integer is being cast to const char * then dereferenced by
printf().
Your C-Reduce interestingness test needs to include undefined behavior
checks, in practice it is often sufficient to run ASan, UBSan, and also
to look for some printf-related compiler warnings. These tools,
together, aren't 100% reliable but they're often good enough.
John
45c45 < my $COMPILER_TIMEOUT = 150;#extensions need more time --- > my $COMPILER_TIMEOUT = 120; 77c77 < my $COMPILE_OPTIONS = "-O1"; --- > my $COMPILE_OPTIONS = ""; 237,262d236 < my $index = $n%11; < use Switch; < switch($index){ < case 0 {$CSMITH_USER_OPTIONS = "--no-paranoid --bitfields --packed-struct --computed-goto";} < < case 1 {$CSMITH_USER_OPTIONS = "--no-paranoid --bitfields --packed-struct --stmt_expr";} < < case 2 {$CSMITH_USER_OPTIONS = "--no-paranoid --bitfields --packed-struct --typeof";} < < case 3 {$CSMITH_USER_OPTIONS = "--no-paranoid --bitfields --packed-struct --int128 --uint128";} < < case 4 {$CSMITH_USER_OPTIONS = "--no-paranoid --bitfields --packed-struct --loc-labels";} < < case 5 {$CSMITH_USER_OPTIONS = "--no-paranoid --bitfields --packed-struct --binary";} < < case 6 {$CSMITH_USER_OPTIONS = "--no-paranoid --bitfields --packed-struct --union-cast";} < < case 7 {$CSMITH_USER_OPTIONS = "--no-paranoid --bitfields --packed-struct --variable-attribute-aligned" ;} < < case 8 {$CSMITH_USER_OPTIONS = "--no-paranoid --bitfields --packed-struct --variable-attribute-unused";} < < case 9 {$CSMITH_USER_OPTIONS = "--no-paranoid --bitfields --packed-struct --variable-attribute-section";} < < case 10 {$CSMITH_USER_OPTIONS = "--no-paranoid --bitfields --packed-struct --label-attribute-hot-cold";} < } < print "$CSMITH_USER_OPTIONS"; 286c260 < print "\nseed= $seed, size= $filesize\n"; --- > print "seed= $seed, size= $filesize\n";
58c58 < system "nice -19 nohup ../compiler_test.pl 55000 ../$CONFIG_FILE --with-wrong-code-bugs> output.txt 2>&1 &"; --- > system "nice -19 nohup ../compiler_test.pl 0 ../$CONFIG_FILE > output.txt 2>&1 &";