This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] nptl: Add compiler barrier in nptl/tst-pthread-getattr
- From: Andreas Schwab <schwab at suse dot de>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 22 Jul 2019 13:58:01 +0200
- Subject: Re: [PATCH] nptl: Add compiler barrier in nptl/tst-pthread-getattr
- References: <87blxms3r1.fsf@oldenburg2.str.redhat.com>
On Jul 22 2019, Florian Weimer <fweimer@redhat.com> wrote:
> Recent GCC versions warn about the attempt to return the address of a
> local variable:
>
> tst-pthread-getattr.c: In function ‘allocate_and_test’:
> tst-pthread-getattr.c:54:10: error: function returns address of local variable [-Werror=return-local-addr]
> 54 | return mem;
> | ^~~
> In file included from ../include/alloca.h:3,
> from tst-pthread-getattr.c:26:
> ../stdlib/alloca.h:35:23: note: declared here
> 35 | # define alloca(size) __builtin_alloca (size)
> | ^~~~~~~~~~~~~~~~~~~~~~~
> tst-pthread-getattr.c:51:9: note: in expansion of macro ‘alloca’
> 51 | mem = alloca ((size_t) (mem - target));
> | ^~~~~~
>
> 2019-07-22 Florian Weimer <fweimer@redhat.com>
>
> * nptl/tst-pthread-getattr.c (compiler_barrier): New function.
> (allocate_and_test): Use it.
Does it work to change the return type to uintptr_t?
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."