This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PING][RFC][BZ #7233] Do not let tr_break call be optimized away.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]