From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by sourceware.org (Postfix) with ESMTPS id 32C27395A45B for ; Wed, 16 Nov 2022 15:27:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 32C27395A45B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-x12f.google.com with SMTP id d6so30039298lfs.10 for ; Wed, 16 Nov 2022 07:27:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=DU2H3wn/A/g8QcG10YousKeswOMmvvHvoiG2pt05CZg=; b=UBt9aBdYJW/pGQID4gBEZ6xBsrVCzbA6pH0zAbvfIbv1vqtnwokrTQR6+MieKx/9nS jxqHNRWJyyJdk5wV27uCaPtQHyyDMxTVKIoY2OW5kJKyt7Bd116GlLVciFX3w3+BrC23 OkG8HwIxjLiVItVtuK4YR6JDtDw0aSmlATDdDOaN64lPMPJu/1HrYDa9svk4QLNqSCp4 131nP7tv65oh8VGjLcBcvL/txXGDNKX1MfDDtSjeKBJyzIkg8B/XOW5q2qvnhIVxxKAu sDJrxQbKoX+aLuRBcNDcySqPVX2VOvkRL4CEfXWfUxUr+T1oRN2FlcspSo6DwIpOpLC9 mz3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DU2H3wn/A/g8QcG10YousKeswOMmvvHvoiG2pt05CZg=; b=V/Cv0pUesOVoNs/EOUqVX2NkDvRHwy5T2aYekYqMV0oM2ISNalHAC1qhFB69igXRmd 6y6oNtjRDeoRs4VTfEanSBx7WW3+01JWoUrK0VyrevEFX9k/HswXhdfPMyiIuMeeA0zi lQDnm/mdVeGNLq7Ra9E8ui+mXymi/LpidosPHETXB4oSb2YCOceyzg0VKdwqKEArM93i qDLXHFPEuYc+y9kQkltvIELvWmVNYaBN1u66PRCLqLo0q4HLD97qOa706Iv9BJDY7RhZ MU7H745BcijtjT4QpRR4SOzMKrNtt9gQ5K34uayGKJCEK1biVKXIhuRZJj+H/pNNWADZ SYiA== X-Gm-Message-State: ANoB5pm3gu5JKAd4KSxTKQD1x4dne/kodVuIaNA+a5w8eVERj8MYQoX4 lCaa7BwcgAPURu3EhoX/1lytcHmFH8SLnPMdN5I= X-Google-Smtp-Source: AA0mqf6bU2+m3PBQDsOuuWdRQIpEKZmHfTimvZCPu29iRzbiYr1NEchs1e8zs3lsdoNpy3LPhI1etbJHF501HPPHwJ0= X-Received: by 2002:a05:6512:702:b0:4b1:7972:627a with SMTP id b2-20020a056512070200b004b17972627amr6984428lfs.101.1668612465380; Wed, 16 Nov 2022 07:27:45 -0800 (PST) MIME-Version: 1.0 References: <24ed5604-305a-4343-a1b6-a789e4723849@app.fastmail.com> <251923e7-57be-1611-be10-49c3067adf0d@cs.ucla.edu> <7ef0ce03-d908-649a-a6ee-89fea374d2b1@cs.ucla.edu> <9cb106e9-16ff-65ec-6a44-6567c77521dc@cs.ucla.edu> <06a5d2cd-44eb-7404-17f3-ff64dd505427@cs.ucla.edu> <27264d94-9496-d7ef-6716-f43db86f38e2@ispras.ru> In-Reply-To: From: Richard Biener Date: Wed, 16 Nov 2022 16:27:32 +0100 Message-ID: Subject: Re: How can Autoconf help with the transition to stricter compilation defaults? To: Michael Matz Cc: Alexander Monakov , Paul Eggert , Jonathan Wakely , Aaron Ballman , Zack Weinberg , c-std-porting@lists.linux.dev, autoconf@gnu.org, gcc@gcc.gnu.org, cfe-commits@lists.llvm.org, Gnulib bugs Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 List-Id: On Wed, Nov 16, 2022 at 4:02 PM Michael Matz via Gcc wrote: > > Hey, > > On Wed, 16 Nov 2022, Alexander Monakov wrote: > > > > The idea is so obvious that I'm probably missing something, why autoconf > > > can't use that idiom instead. But perhaps the (historic?) reasons why it > > > couldn't be used are gone now? > > > > Ironically, modern GCC and LLVM optimize '&foobar != 0' to '1' even at -O0, > > and thus no symbol reference remains in the resulting assembly. > > Err, right, *head-->table*. > Playing with volatile should help: > > char foobar(void); > char (* volatile ptr)(void); > int main(void) { > ptr = foobar; > return ptr != 0; > } using printf for foobar this works even with GCC 2.95.2 and with trunk and -Wall diagnoses t.c:1:6: warning: conflicting types for built-in function 'printf'; expected 'int(const char *, ...)' [-Wbuiltin-declaration-mismatch] 1 | char printf(void); | ^~~~~~ t.c:1:1: note: 'printf' is declared in header '' +++ |+#include 1 | char printf(void); so without -Werror this should be fine. Richard. > > > Ciao, > Michael.