https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70507

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Wed Jun  8 19:03:17 2016
New Revision: 237238

URL: https://gcc.gnu.org/viewcvs?rev=237238&root=gcc&view=rev
Log:
        PR c++/70507
        PR c/68120
        * builtins.def (BUILT_IN_ADD_OVERFLOW_P, BUILT_IN_SUB_OVERFLOW_P,
        BUILT_IN_MUL_OVERFLOW_P): New builtins.
        * builtins.c: Include gimple-fold.h.
        (fold_builtin_arith_overflow): Handle
        BUILT_IN_{ADD,SUB,MUL}_OVERFLOW_P.
        (fold_builtin_3): Likewise.
        * doc/extend.texi (Integer Overflow Builtins): Document
        __builtin_{add,sub,mul}_overflow_p.
gcc/c/
        * c-typeck.c (convert_arguments): Don't promote last argument
        of BUILT_IN_{ADD,SUB,MUL}_OVERFLOW_P.
gcc/cp/
        * constexpr.c: Include gimple-fold.h.
        (cxx_eval_internal_function): New function.
        (cxx_eval_call_expression): Call it.
        (potential_constant_expression_1): Handle integer arithmetic
        overflow built-ins.
        * tree.c (builtin_valid_in_constant_expr_p): Handle
        BUILT_IN_{ADD,SUB,MUL}_OVERFLOW_P.
gcc/c-family/
        * c-common.c (check_builtin_function_arguments): Handle
        BUILT_IN_{ADD,SUB,MUL}_OVERFLOW_P.
gcc/testsuite/
        * c-c++-common/builtin-arith-overflow-1.c: Add test cases.
        * c-c++-common/builtin-arith-overflow-2.c: New test.
        * g++.dg/ext/builtin-arith-overflow-1.C: New test.
        * g++.dg/cpp0x/constexpr-arith-overflow.C: New test.
        * g++.dg/cpp1y/constexpr-arith-overflow.C: New test.

Added:
    trunk/gcc/testsuite/c-c++-common/builtin-arith-overflow-2.c
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-arith-overflow.C
    trunk/gcc/testsuite/g++.dg/cpp1y/constexpr-arith-overflow.C
    trunk/gcc/testsuite/g++.dg/ext/builtin-arith-overflow-1.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/builtins.c
    trunk/gcc/builtins.def
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-common.c
    trunk/gcc/c/ChangeLog
    trunk/gcc/c/c-typeck.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/constexpr.c
    trunk/gcc/cp/tree.c
    trunk/gcc/doc/extend.texi
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/c-c++-common/builtin-arith-overflow-1.c

Reply via email to