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

Re: [csmith-dev] Is this a wrong code bug?



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