From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 535 invoked from network); 27 Jul 2020 14:20:47 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 27 Jul 2020 14:20:47 -0000 Received: (qmail 21240 invoked by alias); 27 Jul 2020 14:20:40 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: Sender: zsh-workers@zsh.org X-Seq: 46269 Received: (qmail 3677 invoked by uid 1010); 27 Jul 2020 14:20:40 -0000 X-Qmail-Scanner-Diagnostics: from mail-io1-f50.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25884. spamassassin: 3.4.4. Clear:RC:0(209.85.166.50):SA:0(-2.0/5.0):. Processed in 1.825003 secs); 27 Jul 2020 14:20:40 -0000 X-Envelope-From: roman.perepelitsa@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.166.50 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5S6LoExzZFVNHG56j62oRrhsArcHnbwmvwcloWOiJgo=; b=t6zx5oi0E13uul1jn+/NQTbpqE7OZJ8d6mkTMbCPDmqVbpy1Ou+4AIEquhq8wX+1pL 92hdTTcp9+Nn9IYSLRKDoWFrrI8ZMALhML3OPT3OBujpEefL1R19lnBixDZv/wnKet2B TAQW1nucwhsnjQ/JfzNtYwbNO+wbmdlRqC0t2LI6VfDkV8IIAHZEu3bC22GLmSCvB9NN PbH79N6oUhHKs3Gubr0laVT1PKdxcau09uAwYDk4fc940Op42kugEoNujBYocvGJ32lf jHvvVbr0cTdU8ET22W1iqUMm7kuI9KBJwGTzJ2FuLe3JRtgMsOc9NIDswRDD6JcpaJFj cmkA== X-Gm-Message-State: AOAM531DYRKC2Dzaz0l3tgPtKnKcjt5rzFeTasPyIvO+uo/n+r5aDMfS CeIHHhz4uXtTNLcfgqMu/rhdw4dF0k8NkRpvGcw= X-Google-Smtp-Source: ABdhPJzCHVyNDmr8tkyDgpiaaxj4WIk+N/ZI+ZIZwMUxSl7TBDyBMh4mC10/sRV9QgsdHTWA/QdeNhMTh81LsYCYtBU= X-Received: by 2002:a05:6638:594:: with SMTP id a20mr27106423jar.127.1595859605884; Mon, 27 Jul 2020 07:20:05 -0700 (PDT) MIME-Version: 1.0 References: <35bf1c7b-163f-4baf-9d5a-c1d7e72459ec@www.fastmail.com> In-Reply-To: From: Roman Perepelitsa Date: Mon, 27 Jul 2020 16:19:54 +0200 Message-ID: Subject: Re: Fwd: 5.8: LTO exposes some new issues To: =?UTF-8?Q?Tomasz_K=C5=82oczko?= Cc: Daniel Shahaf , Zsh hackers list Content-Type: multipart/mixed; boundary="000000000000ebc78905ab6d04b9" --000000000000ebc78905ab6d04b9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jul 27, 2020 at 2:47 PM Tomasz K=C5=82oczko wrote: > Here is whole list of compile and linking warnings: > > utils.c: In function 'getkeystring': > lto1: warning: function may return address of local variable [-Wreturn-lo= cal-addr] > utils.c:6644:16: note: declared here > 6644 | char *buf, tmp[1]; > | ^ This one might be a real bug. At the end of getkeystring there is an explicit check for `how & GETKEY_SINGLE_CHAR`. If this condition is true at that point, the code runs into undefined behavior. First, writing to `*t` is illegal because it points outside of `tmp`. Second, returning `buf` is illegal because it holds a pointer to a local variable (hence the warning). I'm attaching a patch that keeps the branch (although I'm not sure it's reachable) and makes the code less broken if it ever triggers. I cannot verify that it gets rid of the warning because I don't get this warning with unmodified code. FYI: I won't be doing anything about the warning in gettempname (which I'm not getting with my toolchain). Roman. --000000000000ebc78905ab6d04b9 Content-Type: text/plain; charset="US-ASCII"; name="explicit-single-char-return.txt" Content-Disposition: attachment; filename="explicit-single-char-return.txt" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_kd4ljwbp0 ZGlmZiAtLWdpdCBhL1NyYy91dGlscy5jIGIvU3JjL3V0aWxzLmMKaW5kZXggNTE1MWI4OWE4Li5l MDNmNDE0NjggMTAwNjQ0Ci0tLSBhL1NyYy91dGlscy5jCisrKyBiL1NyYy91dGlscy5jCkBAIC03 MTYyLDExICs3MTYyLDEzIEBAIGdldGtleXN0cmluZyhjaGFyICpzLCBpbnQgKmxlbiwgaW50IGhv dywgaW50ICptaXNjKQogICAgICAqLwogICAgIERQVVRTKChob3cgJiAoR0VUS0VZX0RPTExBUl9R VU9URXxHRVRLRVlfVVBEQVRFX09GRlNFVCkpID09CiAJICBHRVRLRVlfRE9MTEFSX1FVT1RFLCAi QlVHOiB1bnRlcm1pbmF0ZWQgJCcgc3Vic3RpdHV0aW9uIik7CisgICAgaWYgKGhvdyAmIEdFVEtF WV9TSU5HTEVfQ0hBUikgeworCSptaXNjID0gMDsKKwlyZXR1cm4gczsKKyAgICB9CiAgICAgKnQg PSAnXDAnOwogICAgIGlmIChob3cgJiBHRVRLRVlfRE9MTEFSX1FVT1RFKQogCSp0ZGVzdCA9ICdc MCc7Ci0gICAgaWYgKGhvdyAmIEdFVEtFWV9TSU5HTEVfQ0hBUikKLQkqbWlzYyA9IDA7CiAgICAg ZWxzZQogCSpsZW4gPSAoKGhvdyAmIEdFVEtFWV9ET0xMQVJfUVVPVEUpID8gdGRlc3QgOiB0KSAt IGJ1ZjsKICAgICByZXR1cm4gYnVmOwo= --000000000000ebc78905ab6d04b9--