internal-fn.c (expand_arith_set_overflow): New function.
authorJakub Jelinek <jakub@redhat.com>
Fri, 24 Jun 2016 11:03:27 +0000 (13:03 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 24 Jun 2016 11:03:27 +0000 (13:03 +0200)
commita86451b9b20415805e6316638c349cce86252893
tree5dbe637ae3f46f81d9ccbd90d3728bb4271209fe
parent43535362e718a0ecb559eb6b1b90cf7892324f08
internal-fn.c (expand_arith_set_overflow): New function.

* internal-fn.c (expand_arith_set_overflow): New function.
(expand_addsub_overflow, expand_neg_overflow, expand_mul_overflow):
Use it.
(expand_arith_overflow_result_store): Likewise.  Handle precision
smaller than mode precision.
* tree-vrp.c (extract_range_basic): For imag part, handle
properly signed 1-bit precision result.
* doc/extend.texi (__builtin_add_overflow): Document that last
argument can't be pointer to enumerated or boolean type.
(__builtin_add_overflow_p): Document that last argument can't
have enumerated or boolean type.

* c-common.c (check_builtin_function_arguments): Require last
argument of BUILT_IN_*_OVERFLOW_P to have INTEGER_TYPE type.
Adjust wording of diagnostics for BUILT_IN_*_OVERLFLOW
if the last argument is pointer to enumerated or boolean type.

* c-c++-common/builtin-arith-overflow-1.c (generic_wrong_type, f3,
f4): Adjust expected diagnostics.
* c-c++-common/torture/builtin-arith-overflow.h (TP): New macro.
(T): If OVFP is defined, redefine to TP.
* c-c++-common/torture/builtin-arith-overflow-12.c: Adjust comment.
* c-c++-common/torture/builtin-arith-overflow-p-1.c: New test.
* c-c++-common/torture/builtin-arith-overflow-p-2.c: New test.
* c-c++-common/torture/builtin-arith-overflow-p-3.c: New test.
* c-c++-common/torture/builtin-arith-overflow-p-4.c: New test.
* c-c++-common/torture/builtin-arith-overflow-p-5.c: New test.
* c-c++-common/torture/builtin-arith-overflow-p-6.c: New test.
* c-c++-common/torture/builtin-arith-overflow-p-7.c: New test.
* c-c++-common/torture/builtin-arith-overflow-p-8.c: New test.
* c-c++-common/torture/builtin-arith-overflow-p-9.c: New test.
* c-c++-common/torture/builtin-arith-overflow-p-10.c: New test.
* c-c++-common/torture/builtin-arith-overflow-p-11.c: New test.
* c-c++-common/torture/builtin-arith-overflow-p-12.c: New test.
* c-c++-common/torture/builtin-arith-overflow-p-13.c: New test.
* c-c++-common/torture/builtin-arith-overflow-p-14.c: New test.
* c-c++-common/torture/builtin-arith-overflow-p-15.c: New test.
* c-c++-common/torture/builtin-arith-overflow-p-16.c: New test.
* c-c++-common/torture/builtin-arith-overflow-p-17.c: New test.
* c-c++-common/torture/builtin-arith-overflow-p-18.c: New test.
* c-c++-common/torture/builtin-arith-overflow-p-19.c: New test.
* g++.dg/ext/builtin-arith-overflow-1.C: Pass 0 instead of C
as last argument to __builtin_add_overflow_p.

From-SVN: r237754
30 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/doc/extend.texi
gcc/internal-fn.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/builtin-arith-overflow-1.c
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-12.c
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-p-1.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-p-10.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-p-11.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-p-12.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-p-13.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-p-14.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-p-15.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-p-16.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-p-17.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-p-18.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-p-19.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-p-2.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-p-3.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-p-4.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-p-5.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-p-6.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-p-7.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-p-8.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-p-9.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/torture/builtin-arith-overflow.h
gcc/testsuite/g++.dg/ext/builtin-arith-overflow-1.C
gcc/tree-vrp.c