https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93644

--- Comment #10 from eggert at cs dot ucla.edu ---
The generic workaround that Bruno describes ran into problems in Gnulib, as
it's enabled only when compiled with -DGCC_LINT, and some users don't compile
it that way. So we now have a more elaborate workaround:

https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=5a8a1598e1243599feb302f0f75d947553f2918f

that causes GCC to issue warnings like the following when the file is not
compiled with -DGCC_LINT:

careadlinkat.c:58:4: warning: #warning "GCC might issue a bogus
-Wreturn-local-addr warning here." [-Wcpp]
   58 | #  warning "GCC might issue a bogus -Wreturn-local-addr warning here."
      |    ^~~~~~~
careadlinkat.c:59:4: warning: #warning "See
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93644>." [-Wcpp]
   59 | #  warning "See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93644>."
      |    ^~~~~~~
careadlinkat.c: In function ‘careadlinkat’:
careadlinkat.c:193:10: warning: function may return address of local variable
[-Wreturn-local-addr]
  193 |   return readlink_stk (fd, filename, buffer, buffer_size, alloc,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  194 |                        preadlinkat, stack_buf);
      |                        ~~~~~~~~~~~~~~~~~~~~~~~
careadlinkat.c:192:8: note: declared here
  192 |   char stack_buf[STACK_BUF_SIZE];
      |        ^~~~~~~~~


but obviously this is awkward and it would be better if the bug were fixed.

Reply via email to