This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] integer overflow checking builtins in constant expressions
- From: Marek Polacek <polacek at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Jason Merrill <jason at redhat dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, Martin Sebor <msebor at gmail dot com>, Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 7 Jun 2016 11:11:59 +0200
- Subject: Re: [PATCH] integer overflow checking builtins in constant expressions
- Authentication-results: sourceware.org; auth=none
- References: <574FA3BC dot 8090603 at gmail dot com> <20160602072316 dot GY28550 at tucnak dot redhat dot com> <5750BF82 dot 5030203 at gmail dot com> <5750CF25 dot 1080801 at gmail dot com> <20160603070637 dot GA7387 at tucnak dot redhat dot com> <5751A26C dot 1060201 at gmail dot com> <20160603153235 dot GK7387 at tucnak dot redhat dot com> <5751E408 dot 1010707 at gmail dot com> <20160606123617 dot GW7387 at tucnak dot redhat dot com> <20160606194408 dot GG7387 at tucnak dot redhat dot com>
On Mon, Jun 06, 2016 at 09:44:08PM +0200, Jakub Jelinek wrote:
> Hi!
>
> On Mon, Jun 06, 2016 at 02:36:17PM +0200, Jakub Jelinek wrote:
> > 2016-06-06 Martin Sebor <msebor@redhat.com>
> > Jakub Jelinek <jakub@redhat.com>
> >
> > 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): Likewise.
> > 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/cpp0x/constexpr-arith-overflow.C: New test.
> > * g++.dg/cpp1y/constexpr-arith-overflow.C: New test.
>
> Now successfully bootstrapped/regtested on x86_64-linux and i686-linux, ok
> for trunk?
I just played with this a bit -- nice. The c/ and c-family/ parts are OK.
Marek