[PATCH] Don't leak C_MAYBE_CONST_EXPRs into gimplifier from float-cast instrumentation (PR sanitizer/69099)

Jeff Law law@redhat.com
Tue Jan 5 18:50:00 GMT 2016


On 01/05/2016 06:03 AM, Marek Polacek wrote:
> The problem in this PR is that we were leaking C_MAYBE_CONST_EXPRs into the
> gimplifier.  It was created in the float-cast instrumentation in convert().
>
> Fixed by using the fully-folded EXPR only, thus without C_MAYBE_CONST_EXPR.
> Which means that we can drop a parameter of ubsan_instrument_float_cast.
> Seems that this doesn't hurt the diagnostics.
>
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
>
> 2016-01-05  Marek Polacek  <polacek@redhat.com>
>
> 	PR sanitizer/69099
> 	* c-convert.c (convert) [INTEGER_TYPE]: Drop ARG.  Don't pass ARG to
> 	ubsan_instrument_float_cast.  Fold EXPR.
>
> 	* convert.c (convert_to_integer_1): Adjust call to
> 	ubsan_instrument_float_cast.
> 	* ubsan.c (ubsan_instrument_float_cast): Drop the ARG parameter.  Use
> 	EXPR instead of ARG.
> 	* ubsan.h (ubsan_instrument_float_cast): Adjust declaration.
>
> 	* gcc.dg/ubsan/float-cast-overflow-atomic.c: New test.
OK.  You might want to mention the change from NULL to NULL_TREE in the 
ChangeLog as well.

jeff



More information about the Gcc-patches mailing list