|
From: | Paul Eggert |
Subject: | Re: [PATCH] careadlinkat: fix GCC 10 workaround |
Date: | Mon, 17 Aug 2020 12:49:30 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 8/17/20 10:10 AM, Bruno Haible wrote:
Paul Eggert wrote:What's wrong with avoiding the problem via GCC_LINT?Some people, especially those that build distros, want to get warnings about the exact code that they ship in the distro, not about some different code.
Those people can build and ship with CFLAGS='-DGCC_LINT'. This may hurt performance on their platforms a bit, but if they're willing to pay that price to pacify bogus warnings then that's OK. Conversely, if they want to avoid the minor performance hits without generating this particular bogus warning, they can build and ship with CFLAGS='-Wno-return-local-addr'.
How about this modification? It splits the function into two functions, and unless the first function is inlined, the warning disappears.
Thanks, that's a good idea for GCC 10 since it lets the code allocate the first buffer on the stack too, even if warnings are enabled. However, I would rather have the code use __attribute__ ((__noinline__)) only if GCC_LINT is defined. The point of GCC_LINT is to make it clear to readers how code is written a particular way merely to pacify bogus compiler warnings. I'd rather do this systematically, rather than use GCC_LINT in some places where the problem occurs and not use it in others. With that in mind, I installed the attached patch.
0001-careadlinkat-speedup-for-GCC-10-with-GCC_LINT.patch
Description: Text Data
[Prev in Thread] | Current Thread | [Next in Thread] |