On Wed, Oct 14, 2015 at 01:51:44PM +0300, Maxim Ostapenko wrote: > Ok, got it. The first solution would require changes in libsanitizer because > heuristic doesn't work for GCC, so perhaps new UBSan entry point should go > upstream, right? Or this may be implemented as local patch for GCC?
No. The heuristics relies on: 1) either it is old style float cast overflow without location 2) or it is new style float cast with location, but the location must: a) not have NULL filename b) the filename must not be "" c) the filename must not be "\1" So, my proposal was to emit in GCC the old style float cast overflow if a), b) or c) is true, otherwise the new style. I have no idea what you mean by heuristic doesn't work for GCC after that. > BTW, I actually saw UNKNOWN_LOCATION for this expr: > > volatile double var; // this is tcc_decaration, so we have UNKNOWN_LOCATION > for it. This is not a complete testcase, so I wonder what exactly you are talking about. The above doesn't not generate any __ubsan_handle_float_cast_overflow calls with -fsanitize=float-cast-overflow, and volatile double d; int bar (void) { return d; } has location. Jakub