This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PING][RFC][BZ #7233] Do not let tr_break call be optimized away.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: libc-alpha at sourceware dot org
- Date: Mon, 21 Oct 2013 09:00:09 +0200
- Subject: [PING][RFC][BZ #7233] Do not let tr_break call be optimized away.
- Authentication-results: sourceware.org; auth=none
- References: <20131017180904 dot GA5296 at domone dot podge>
ping
On Thu, Oct 17, 2013 at 08:09:04PM +0200, OndÅej BÃlka wrote:
> Hi,
>
> In following bug a gcc optimizes tr_break call in tr_freehook. Adding
> side effect prevents that.
>
> Is using asm portable way to archieve that or is there a better way?
>
> * malloc/mtrace.c (tr_break): Prevent compiler to optimize calls away.
>
> diff --git a/malloc/mtrace.c b/malloc/mtrace.c
> index ee94133..691b7a2 100644
> --- a/malloc/mtrace.c
> +++ b/malloc/mtrace.c
> @@ -71,9 +71,11 @@ static __ptr_t (*tr_old_memalign_hook) (size_t __alignment, size_t __size,
>
> extern void tr_break (void) __THROW;
> libc_hidden_proto (tr_break)
> -void
> +void
> +__attribute__ ((noinline))
> tr_break (void)
> {
> + __asm__ __volatile__ ("");
> }
> libc_hidden_def (tr_break)
>
--
Change in Earth's rotational speed