coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gcc10's -Wreturn-local-addr gives FP warning about lib/careadlinkat


From: Pádraig Brady
Subject: Re: gcc10's -Wreturn-local-addr gives FP warning about lib/careadlinkat
Date: Thu, 6 Feb 2020 14:03:22 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:73.0) Gecko/20100101 Thunderbird/73.0

On 06/02/2020 00:27, Jim Meyering wrote:
Building latest latest coreutils using latest-from-git gcc10 evokes
this false positive:

lib/careadlinkat.c: In function 'careadlinkat':
cc1: error: function may return address of local variable
[-Werror=return-local-addr]
lib/careadlinkat.c:73:8: note: declared here
    73 |   char stack_buf[1024];

I'm guessing improved flow analysis will eventually suppress this. I
hesitate to turn off the useful and normally-high-S/N
-Wreturn-local-addr globally. Maybe just disable it in that one file,
temporarily?

The logic of the function looks fine.
Would an `assure (buf != stack_buf)` before the `return buf`
indicate that constraint to gcc with minimal runtime overhead?

cheers,
Pádraig





reply via email to

[Prev in Thread] Current Thread [Next in Thread]