This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PING [PATCH] PR c/19978 multiple overflow warnings


Please C/C++ reviewers (tree.h changes are already approved),

PING http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00588.html

I have a patch that fixes another PR (no regression, though) ready for
submission that depends on these changes.

Thanks,

Manuel.

On 09/12/06, Manuel LÃpez-IbÃÃez <lopezibanez@gmail.com> wrote:
:ADDPATCH c/c++:

The following patch fixes PR c/19978: once an expression overflowed,
an extra overflow warning is given for each additional operator that
appears in the expression. This also affects unary operators in C++
but it seems no one noticed that.

With this patch overflow warnings are emitted only if the result of a
binary or unary operation has TREE_OVERFLOW set, but its operands did
not.

The testcases multiple-overflow-warn-* have been checked to fail with
current mainline.  I have also added overflow-warn-6.c  to test that
everything works fine when the result of an operator is
CONSTANT_CLASS_P and its operands are not.

Bootstrapped and regression tested with --enable-languages=all on
i686-pc-linux-gnu for mainline revision 119259.

The changes to tree.h have been pre-approved by Roger Sayle.


2006-12-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>


    PR c/19978
    * tree.h (TREE_OVERFLOW_P): New.
    * cp/semantics.c (finish_unary_op_expr): Warn only if result
overflowed and operands did not.
    * c-typeck.c (parser_build_unary_op): Likewise.
    (parser_build_binary_op): Likewise.
    (convert_for_assignment): Remove redundant overflow_warning.
    * c-common.c (overflow_warning): Don't check or set TREE_OVERFLOW.

testsuite/
2006-12-09  Manuel Lopez-Ibanez <manu@gcc.gnu.org>

    PR c/19978
    * gcc.dg/multiple-overflow-warn-1.c: New.
    * gcc.dg/multiple-overflow-warn-2.c: New.
    * gcc.dg/overflow-warn-6.c: New.
    * g++.dg/warn/multiple-overflow-warn-1.C: New.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]