[PATCH] Promote NPCs used as arguments to variadic functions
Reid Kleckner
rnk at google.com
Thu Oct 2 14:22:08 PDT 2014
>>! In D5480#13, @majnemer wrote:
> Perhaps a warning should be added so code doesn't "miscompile" when compiled with GCC?
I don't think the warning is actionable for the user. How do we avoid false positives on printf("%d\n", 0)?
Users are typically saavy enough to know that passing '0' to a varargs function will be interpreted as an int, or at least be able to debug the crash once it happens. The subtle case is when passing NULL, which 99% of the time just works with GCC's stddef.h. In the 1% corner case where NULL is defined incorrectly (literal 0 and not 0L), I can live the fact that clang and gcc will have subtle behavior differences.
> Is there a reason to restrict this just to null pointer constants?
I don't see why we should implicitly widen all ints to i64 in varargs contexts.
http://reviews.llvm.org/D5480
More information about the cfe-commits
mailing list