From patchwork Wed Nov 2 09:13:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 1698083 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=CeBiTec.Uni-Bielefeld.DE header.i=@CeBiTec.Uni-Bielefeld.DE header.a=rsa-sha256 header.s=20200306 header.b=JAoNnqet; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4N2Lmd33s4z23lK for ; Wed, 2 Nov 2022 20:14:08 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 56A1538582A0 for ; Wed, 2 Nov 2022 09:14:01 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp.CeBiTec.Uni-Bielefeld.DE (smtp.CeBiTec.Uni-Bielefeld.DE [129.70.160.84]) by sourceware.org (Postfix) with ESMTPS id 0B4593858CDA for ; Wed, 2 Nov 2022 09:13:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0B4593858CDA Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=CeBiTec.Uni-Bielefeld.DE Authentication-Results: sourceware.org; spf=none smtp.mailfrom=cebitec.uni-bielefeld.de Received: from localhost (localhost [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id A4593B05DE; Wed, 2 Nov 2022 10:13:45 +0100 (CET) X-Virus-Scanned: amavisd-new at CeBiTec.Uni-Bielefeld.DE Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (smtp.cebitec.uni-bielefeld.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UhPhsBZclZLK; Wed, 2 Nov 2022 10:13:45 +0100 (CET) Received: from manam.CeBiTec.Uni-Bielefeld.DE (p50855a16.dip0.t-ipconnect.de [80.133.90.22]) (Authenticated sender: ro) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPSA id 228D3B04E0; Wed, 2 Nov 2022 10:13:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=CeBiTec.Uni-Bielefeld.DE; s=20200306; t=1667380425; bh=KsFdjM+Ie+3/eVmFY59VPdx9jy8/f3q8VVydMIryW94=; h=From:To:Cc:Subject:Date:From; b=JAoNnqetekER+QfMBSti068U2TMFfk0iA5KJQPgirPDmDBr7MhoTwqb3xbXWMMpJv Y+QHkpSLILs+V/1W94sYwa5iGMduRfX+nI8h5UIXwvTYCA+PPk6eUw8dDby+JEGpLc egvdD5dYjQ6wPZWHlJGsYznyUrNZKo+pCqTznJRqh3zP7m2vwchncMtsPqDwC55kVS gtEMuhLpWnImIZ8z9Ye779jcQtntFtQ+P5k+1Kb3bwjTpebgbV0xaYKLFEwyWAcW0E hw+fpuwKA5dLlJyI0HIe4ChJK1zV9NibEyr7usTQAFQ34i1Qlzw4uFDbXsgC0wiTlB lJ/emuLWqZTiw== From: Rainer Orth To: gcc-patches@gcc.gnu.org Subject: [PATCH] builtins: Guard builtins.cc against HUGE_VAL and NAN definitions Date: Wed, 02 Nov 2022 10:13:44 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1.90 (usg-unix-v) MIME-Version: 1.0 X-Spam-Status: No, score=-3795.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jakub Jelinek Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" trunk bootstrap recently broke on Solaris like this: /vol/gcc/src/hg/master/local/gcc/builtins.cc:2104:8: error: pasting "CFN_BUILT_IN_" and "(" does not give a valid preprocessing token 2104 | case CFN_BUILT_IN_##MATHFN: \ | ^~~~~~~~~~~~~ /vol/gcc/src/hg/master/local/gcc/builtins.cc:2112:3: note: in expansion of macro 'CASE_MATHFN' 2112 | CASE_MATHFN(MATHFN) \ | ^~~~~~~~~~~ /vol/gcc/src/hg/master/local/gcc/builtins.cc:1967:5: note: in expansion of macro 'CASE_MATHFN_FLOATN' 1967 | CASE_MATHFN_FLOATN (HUGE_VAL) \ and similarly for NAN. It turns out this happens because is included at some point, which (in ) defines #define HUGE_VAL (__builtin_huge_val()) #define NAN (__builtin_nanf("")) While this only happpens on Solaris right now, the same issue would be present on other targets when gets included somehow. To avoid this, this patch #undef's both macros. Bootstrapped without regressions on i386-pc-solaris2.11 and sparc-sun-solaris2.11. Ok for trunk? Rainer # HG changeset patch # Parent 3e5ba66da20edf52cdfe371ea2244c91d770f64a builtins: Guard builtins.cc against HUGE_VAL and NAN definitions diff --git a/gcc/builtins.cc b/gcc/builtins.cc --- a/gcc/builtins.cc +++ b/gcc/builtins.cc @@ -1931,6 +1931,11 @@ mathfn_built_in_2 (tree type, combined_f built_in_function fcodef64x = END_BUILTINS; built_in_function fcodef128x = END_BUILTINS; + /* If has been included somehow, HUGE_VAL and NAN definitions + break the uses below. */ +#undef HUGE_VAL +#undef NAN + switch (fn) { #define SEQ_OF_CASE_MATHFN \