[PATCH] Fix ubsan -fsanitize=signed-integer-overflow expansion (PR sanitizer/63520)

Jakub Jelinek jakub@redhat.com
Wed Nov 19 09:29:00 GMT 2014


On Wed, Nov 19, 2014 at 10:02:18AM +0100, Richard Biener wrote:
> On Tue, 18 Nov 2014, Jakub Jelinek wrote:
> > Apparently, expand_expr with EXPR_WRITE can return
> > a SUBREG with SUBREG_PROMOTED_VAR_P set on it.  For
> 
> Huh, that looks bogus to me.  But of course I know nothing
> (read: not enough) to really tell.  Eric?

I've tried to look where it comes from, and it dates back to r2xxx
or so, so forever.
And store_expr has a large:
  else if (GET_CODE (target) == SUBREG && SUBREG_PROMOTED_VAR_P (target))
    /* If this is a scalar in a register that is stored in a wider mode
       than the declared mode, compute the result into its declared mode
       and then convert to the wider mode.  Our value is the computed
       expression.  */
handling block.  For targets with only word sized operations something
like that actually makes a lot of sense, I have just not been aware of that.

	Jakub



More information about the Gcc-patches mailing list