From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x934.google.com (mail-ua1-x934.google.com [IPv6:2607:f8b0:4864:20::934]) by sourceware.org (Postfix) with ESMTPS id 08BE23858D3C for ; Wed, 22 Mar 2023 07:21:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 08BE23858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gwmail.gwu.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gwmail.gwu.edu Received: by mail-ua1-x934.google.com with SMTP id p2so11995284uap.1 for ; Wed, 22 Mar 2023 00:21:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gwmail.gwu.edu; s=google; t=1679469661; h=content-transfer-encoding:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=dYT/ekWoGtXtcjZZB0rcKRYbcbR3GlU0MYZI2z5NCLo=; b=SN/2m3mASrz3yaDPnn8daIjVU0bBzz41LLBh8fhLDQ6p07paCZKszFgaa3r91k0e6s wXCnd/ykAzrSKNp0znCstjBxpWpTnmacls7YH8AXKcCrhoCdmwANkYlQ2VhYL723vEnH 0Rgok5j9+ZB9/FzecNo2QGYDixys4X7gQO9cYJzXWfTx13VQ+P4HtpwPy1c4E/q1IY2q eH4w8QiQHV2Jw9b9afluFhLplfWrMbQqCyRM7psIJLpBzbj3Tn89CYTDQ3qTbVxo9QF4 yovW3AGPG0Si/4aw9zSwwNRwctDJofyMtNGhSEwQ2amjU0Rzzq7pvUHogmtB872ZjpxS YXRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679469661; h=content-transfer-encoding:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dYT/ekWoGtXtcjZZB0rcKRYbcbR3GlU0MYZI2z5NCLo=; b=SrqfftfQ1AZry0pOmBd2H5m+6Z+d4R8TUHexrsKzQ35rZC0n2o7rQMMo3VQR3Ed7Bb IOfmite7B0GYgITBzemVtMLIXJuYc3FStHB1L6Id5+nhAS+ldTBhXLzk0AFWOZonmIpY O8qHXAeNMAeVwxvgKYaFDmwP3UwmBuWK5l/b5rFTfbQ/UlkEThcqznSnIEoNkJmoyOEi GcvQV6YCjT/t8c8Xfy7kPC7Bx3Cayn2rZVILLuM1d1QLHr/LRm/JEVt55MEh/+4J5Xgb slEMzuX/2aF6H6/iWwDbQ4JAjJea1yHfPJFrMrnhBvafYGa+ZBV+84YkaCjfDFDivSLw e05A== X-Gm-Message-State: AAQBX9eRIn1rcBM2ip7mtsEWEntl99mbOsT9yUkvtZyxfhEvE9s7Zaak oAirklndyPOXCKIWAjpJ2xKTEujcIQi5/F+6ZVzkFQ== X-Google-Smtp-Source: AKy350blqpnhPlLR0dGmUUYFKpxlHM7brWZsbqmFjowAatkT9VFSYwQ9IGfytyYMs2RDP6SzcHY4vKzDejTQX9SnkDk= X-Received: by 2002:a05:6130:28e:b0:68a:a9d:13f5 with SMTP id q14-20020a056130028e00b0068a0a9d13f5mr2556673uac.1.1679469661236; Wed, 22 Mar 2023 00:21:01 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a59:d807:0:b0:3a9:fd01:95f0 with HTTP; Wed, 22 Mar 2023 00:21:00 -0700 (PDT) In-Reply-To: References: <20230301222856.12300c64@nbbrfq> From: Eric Gallager Date: Wed, 22 Mar 2023 03:21:00 -0400 Message-ID: Subject: Re: [PATCH][stage1] Remove conditionals around free() To: Janne Blomqvist Cc: Bernhard Reutner-Fischer , gcc-patches@gcc.gnu.org, ian@airs.com, charlet@adacore.com, fortran@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,JMQ_SPF_NEUTRAL,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no 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 3/4/23, Janne Blomqvist via Gcc-patches wrote: > On Wed, Mar 1, 2023 at 11:31=E2=80=AFPM Bernhard Reutner-Fischer via Fort= ran > wrote: >> >> Hi! >> >> Mere cosmetics. >> >> - if (foo !=3D NULL) >> free (foo); >> >> With the caveat that coccinelle ruins replacement whitespace or i'm >> uneducated enough to be unable to _not_ run the diff through >> sed -e 's/^+\([[:space:]]*\)free(/+\1free (/' >> at least. If anybody knows how to improve replacement whitespace, >> i'd be interrested but didn't look nor ask. ISTM that leading >> whitespace is somewhat ruined, too, so beware (8 spaces versus tab as >> far as i have spot-checked). >> >> Would touch >> gcc/ada/rtinit.c | 3 +-- >> intl/bindtextdom.c | 3 +-- >> intl/loadmsgcat.c | 6 ++---- >> intl/localcharset.c | 3 +-- >> libbacktrace/xztest.c | 9 +++------ >> libbacktrace/zstdtest.c | 9 +++------ >> libbacktrace/ztest.c | 9 +++------ >> libgfortran/caf/single.c | 6 ++---- >> libgfortran/io/async.c | 6 ++---- >> libgfortran/io/format.c | 3 +-- >> libgfortran/io/transfer.c | 6 ++---- >> libgfortran/io/unix.c | 3 +-- >> libgo/runtime/go-setenv.c | 6 ++---- >> libgo/runtime/go-unsetenv.c | 3 +-- >> libgomp/target.c | 3 +-- >> libiberty/concat.c | 3 +-- >> zlib/contrib/minizip/unzip.c | 2 +- >> zlib/contrib/minizip/zip.c | 2 +- >> zlib/examples/enough.c | 6 ++---- >> zlib/examples/gun.c | 2 +- >> zlib/examples/gzjoin.c | 3 +-- >> zlib/examples/gzlog.c | 6 ++---- >> >> coccinelle script and invocation inline. >> Would need to be split for the respective maintainers and run through >> mklog with subject changelog and should of course be compiled and >> tested before that. >> >> Remarks: >> 1) We should do this in if-conversion (?) on our own. >> I suppose. Independently of -fdelete-null-pointer-checks >> 2) Maybe not silently, but raise language awareness nowadays. >> By now it's been a long time since this was first mandated. >> 3) fallout from looking at something completely different >> 4) i most likely will not remember to split it apart and send proper >> patches, tested patches, in stage 1 to maintainers proper, so if >> anyone feels like pursuing this, be my guest. I thought i'd just >> mention it. >> >> cheers, > > Back in 2011 Jim Meyering applied a patch doing this, see > https://gcc.gnu.org/legacy-ml/gcc-patches/2011-03/msg00403.html , and > the gcc/README.Portability snippet added then which is still there. > > Per analysis done then, it seems SunOS 4 was the last system where > free() of a NULL pointer didn't behave per the spec. > > Also in Jim's patch intl/ and zlib/ directories were not touched as > those are imported from other upstreams. > Speaking of which, this reminded me that I opened bug 80528 to catch code like this as a compiler warning: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D80528 > -- > Janne Blomqvist >