From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24295 invoked by alias); 23 Jun 2015 10:18:36 -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 24280 invoked by uid 89); 23 Jun 2015 10:18:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 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, 23 Jun 2015 10:18:34 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id BFEFF36B179; Tue, 23 Jun 2015 10:18:33 +0000 (UTC) Received: from redhat.com (ovpn-204-34.brq.redhat.com [10.40.204.34]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5NAIU2w021844 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Tue, 23 Jun 2015 06:18:33 -0400 Date: Tue, 23 Jun 2015 10:29:00 -0000 From: Marek Polacek To: Martin Sebor Cc: Gcc Patch List Subject: Re: [PATCH] c/66516 - missing diagnostic on taking the address of a builtin function Message-ID: <20150623101829.GQ10139@redhat.com> References: <5587432A.9000602@redhat.com> <20150622144010.GK10139@redhat.com> <5588BD78.4030607@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5588BD78.4030607@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-06/txt/msg01527.txt.bz2 On Mon, Jun 22, 2015 at 07:59:20PM -0600, Martin Sebor wrote: > >It seems like this patch regresess pr59630.c testcase; I don't see > >the testcase being addressed in this patch. > > Thanks for the review and for pointing out this regression! > I missed it among all the C test suite failures (I see 157 > of them in 24 distinct tests on x86_64.) You might want to use contrib/test_summary and then compare its outputs. > pr59630 is marked ice-on-valid-code even though the call via > the converted pointer is clearly invalid (UB). What's more > relevant, though, is that the test case is one of those that > (while they both compile and link with the unpatched GCC) are > not intended to compile with the patch (and don't compile with > Clang). Right, just turn dg-warning into dg-error. > In this simple case, the call to __builtin_abs(0) is folded > into the constant 0, but in more involved cases GCC emits > a call to abs. It's not clear to me from the manual or from > the builtin tests I've seen whether this is by design or > an accident of the implementation > > Is it intended that programs be able to take the address of > the builtins that correspond to libc functions and make calls > to the underlying libc functions via such pointers? (If so, > the patch will need some tweaking.) I don't think so, at least clang doesn't allow e.g. size_t (*fp) (const char *) = __builtin_strlen; Marek