Fix PR 22018
Diego Novillo
dnovillo@redhat.com
Wed Jun 15 16:10:00 GMT 2005
On Wed, Jun 15, 2005 at 05:53:05PM +0200, Eric Botcazou wrote:
> Sorry for being picky
>
No problem. Thanks for the feedback. It's easy for me to miss
documenting all the silent assumptions the code makes.
> , but this is still not symmetric: "VAL1 + VAL2 grows if
> VAL2 is >= 0". Surely VAL1 and VAL2 can be swapped and the conclusion should
> stay the same. This works because VAL1 + VAL2 can overflow only if VAL1 and
> VAL2 have the same sign, so either (sign1>0 && sign2>0) or (sign1<0 &&
> sign2<0) is true inside the TREE_OVERFLOW (res) block for PLUS_EXPR. So you
> are allowed to only test one of the 2 signs, but IMHO that should be
> explained.
>
> Same for MINUS: "VAL1 - VAL2 grows if VAL2 is < 0" is not antisymmetric. VAL1
> and VAL2 can be swapped and the conclusion must be swapped too. Again this
> works because VAL1 - VAL2 can overflow only if VAL1 and VAL2 doesn't have the
> same sign, so either (sign1>0 && sign2<0) or (sign1<0 && sign2>0) is true
> inside the TREE_OVERFLOW (res) block for MINUS_EXPR. So again you are
> allowed to only test one of the 2 signs.
>
Sure. Mind patching the comment with these added details?
Thanks. Diego.
More information about the Gcc-patches
mailing list