From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 100989 invoked by alias); 7 Jun 2016 09:12:07 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 100980 invoked by uid 89); 7 Jun 2016 09:12:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=played X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 07 Jun 2016 09:12:04 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9F29C85542; Tue, 7 Jun 2016 09:12:03 +0000 (UTC) Received: from redhat.com (ovpn-204-26.brq.redhat.com [10.40.204.26]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u579Bxl3030521 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 7 Jun 2016 05:12:02 -0400 Date: Tue, 07 Jun 2016 09:12:00 -0000 From: Marek Polacek To: Jakub Jelinek Cc: Jason Merrill , "Joseph S. Myers" , Martin Sebor , Gcc Patch List Subject: Re: [PATCH] integer overflow checking builtins in constant expressions Message-ID: <20160607091159.GY3014@redhat.com> References: <574FA3BC.8090603@gmail.com> <20160602072316.GY28550@tucnak.redhat.com> <5750BF82.5030203@gmail.com> <5750CF25.1080801@gmail.com> <20160603070637.GA7387@tucnak.redhat.com> <5751A26C.1060201@gmail.com> <20160603153235.GK7387@tucnak.redhat.com> <5751E408.1010707@gmail.com> <20160606123617.GW7387@tucnak.redhat.com> <20160606194408.GG7387@tucnak.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160606194408.GG7387@tucnak.redhat.com> User-Agent: Mutt/1.6.1 (2016-04-27) X-SW-Source: 2016-06/txt/msg00462.txt.bz2 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 > > Jakub Jelinek > > > > 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