[C++ PATCH] Fix static_cast overflow handling (PR c++/23056) (take 2)

Mark Mitchell mark@codesourcery.com
Mon Sep 5 16:25:00 GMT 2005


Jakub Jelinek wrote:
> On Mon, Sep 05, 2005 at 02:30:23PM +0200, Giovanni Bajo wrote:
> 
>>>Ok to commit for HEAD/4.0 (4.0/4.1 regression) if bootstrap/regtesting
>>>succeeds?
>>
>>Surely you can factor out the new code into a function, to avoid
>>duplication?

This is OK, with a minor change:

> +/* Ignore any integer overflow caused by the static cast of ORIG
> +   to EXPR.  */
> +
> +static tree
> +ignore_static_cast_overflows (tree expr, tree orig)

Let's call this "ignore_overflows" and change the comment to say:

/* If EXPR is an INTEGER_CST and ORIG is an arithmetic constant, return 
a version of EXPR that has TREE_OVERFLOW and/or TREE_CONSTANT_OVERFLOW 
set iff they are set in ORIG.  Otherwise, return EXPR unchanged.  */

Thanks,

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304



More information about the Gcc-patches mailing list