From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 51301 invoked by alias); 12 Dec 2017 21:56:44 -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 50183 invoked by uid 89); 12 Dec 2017 21:56:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=objective X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 Dec 2017 21:56:42 +0000 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vBCLowWB079311 for ; Tue, 12 Dec 2017 16:56:41 -0500 Received: from e14.ny.us.ibm.com (e14.ny.us.ibm.com [129.33.205.204]) by mx0a-001b2d01.pphosted.com with ESMTP id 2etpmnt0pc-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 12 Dec 2017 16:56:40 -0500 Received: from localhost by e14.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 12 Dec 2017 16:56:40 -0500 Received: from b01cxnp22034.gho.pok.ibm.com (9.57.198.24) by e14.ny.us.ibm.com (146.89.104.201) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 12 Dec 2017 16:56:37 -0500 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vBCLub7E52625438; Tue, 12 Dec 2017 21:56:37 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D63A7AE034; Tue, 12 Dec 2017 16:57:37 -0500 (EST) Received: from ibm-tiger.the-meissners.org (unknown [9.32.77.111]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP id B2A47AE03C; Tue, 12 Dec 2017 16:57:37 -0500 (EST) Received: by ibm-tiger.the-meissners.org (Postfix, from userid 500) id 74C4747E52; Tue, 12 Dec 2017 16:56:36 -0500 (EST) Date: Tue, 12 Dec 2017 21:56:00 -0000 From: Michael Meissner To: Segher Boessenkool Cc: Michael Meissner , Martin Sebor , GCC Patches , David Edelsohn , Bill Schmidt Subject: Re: [PATCH] PR libgcc/83112, Fix warnings on libgcc float128-ifunc.c Mail-Followup-To: Michael Meissner , Segher Boessenkool , Martin Sebor , GCC Patches , David Edelsohn , Bill Schmidt References: <20171127192131.GA15914@ibm-tiger.the-meissners.org> <20171127234009.GA28990@ibm-tiger.the-meissners.org> <20171130024250.GX10515@gate.crashing.org> <20171130205425.GA11524@ibm-tiger.the-meissners.org> <20171201054022.GA5348@ibm-tiger.the-meissners.org> <20171201235355.GL10515@gate.crashing.org> <20171211205750.GA16210@ibm-tiger.the-meissners.org> <20171212170455.GT10515@gate.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171212170455.GT10515@gate.crashing.org> User-Agent: Mutt/1.5.20 (2009-12-10) X-TM-AS-GCONF: 00 x-cbid: 17121221-0052-0000-0000-000002903B59 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008195; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000244; SDB=6.00959311; UDB=6.00485148; IPR=6.00739333; BA=6.00005738; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00018508; XFM=3.00000015; UTC=2017-12-12 21:56:39 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17121221-0053-0000-0000-000052E4295B Message-Id: <20171212215635.GA18332@ibm-tiger.the-meissners.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-12-12_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1712120311 X-IsSubscribed: yes X-SW-Source: 2017-12/txt/msg00779.txt.bz2 On Tue, Dec 12, 2017 at 11:04:55AM -0600, Segher Boessenkool wrote: > On Mon, Dec 11, 2017 at 03:57:51PM -0500, Michael Meissner wrote: > > > > +extern KCtype __divkc3 (KFtype, KFtype, KFtype, KFtype); > > > > + > > > > KCtype > > > > __divkc3 (KFtype a, KFtype b, KFtype c, KFtype d) > > > > { > > > > > > How does this warn? -Wmissing-declarations? Should this declaration be > > > in a header then? > > > > The compiler creates the call to __mulkc3 and __divkc3, and internally it has > > the appropriate prototype like it does for all built-in functions (in this > > case, returning an _Float128 _Complex type, and taking 4 _Float128 arguments). > > > > So before adding ifunc support, we never noticed it didn't have a prototype, > > because the compiler already has a prototype. > > I still don't get it. A function definition is also a declaration. > > Something very non-intuitive is happening? GCC has the following function declarations built-in: extern _Float128 _Complex __mulkc3 (_Float128, _Float128, _Float128, _Float128); extern _Float128 _Complex __divkc3 (_Float128, _Float128, _Float128, _Float128); Before the patch, _mulkc3.c looked like: _Float128 _Complex __mulkc3 (_Float128 a, _Float128 b, _Float128 c, _Float128 d) { // ... } Now, with ifunc handling it gets compiled in three separate files: First in a file compiled with -mno-float128-hardware: _Float128 _Complex __mulkc3_sw (_Float128 a, _Float128 b, _Float128 c, _Float128 d) { // ... } Second in a file compiled with -mfloat128-hardware: _Float128 _Complex __mulkc3_hw (_Float128 a, _Float128 b, _Float128 c, _Float128 d) { // ... } And third as the ifunc handler: #define SW_OR_HW(SW, HW) (__builtin_cpu_supports ("ieee128") ? HW : SW) static __typeof__ (__mulkc3_sw) * __mulkc3_resolve (void) { return SW_OR_HW (__mulkc3_sw, __mulkc3_hw); } _Float128 _Complex __mulkc3 (Float128, _Float128, _Float128, _Float128) __attribute__ ((__ifunc__ ("__mulkc3_resolve"))); As Andreas points out, the option -Wmissing-prototypes complains if a global function is compliled without prototypes for C/Objective C. Before the patch, the internal definition within the compiler meant that that __mulkc3 would not get the warning. Now with separate ifunc handlers, both __mulkc3_sw and __mulkc3_hw got warnings. -- Michael Meissner, IBM IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA email: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797