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

--- Comment #11 from eggert at cs dot ucla.edu ---
Created attachment 49783
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49783&action=edit
another instance of a -Wreturn-local-addr false alarm

I ran into a different instance of the bug today, while working on another
Gnulib source file lib/canonicalize.c. A stripped-down test case attached. To
reproduce the problem:

$ gcc -O2 -S return-local-addr.i 
return-local-addr.i: In function ‘canonicalize_filename_mode’:
cc1: warning: function may return address of local variable
[-Wreturn-local-addr]
return-local-addr.i:28:25: note: declared here
   28 |   struct scratch_buffer rname_buffer;
      |                         ^~~~~~~~~~~~

This is with GCC 10.2.1 20201125 (Red Hat 10.2.1-9) on x86-64.

Reply via email to