On Mon, 8 Aug 2011, Ulrich Weigand wrote:

> Richard Guenther wrote:
> 
> > Of course testing for the fold makes sure we also test for the crash ...
> > so yes, the idea was to also test for the fold.  As the LTO testing
> > harness does not support scanning dumps (sigh...) link tests are
> > the only possibility right now.
> 
> OK, so what about the following version?  This keeps not linking against
> libm so it will fail if cabs is not folded.  On the other hand, it will
> provide a dummy implementation of sqrt to avoid failure simply because
> sqrt is not expanded inline ...

Looks good to me.

Richard.

> Bye,
> Ulrich
> 
> 
> ChangeLog:
> 
>       * testsuite/gcc.dg/lto/20110201-1_0.c: Provide dummy sqrt.
> 
> Index: gcc/testsuite/gcc.dg/lto/20110201-1_0.c
> ===================================================================
> *** gcc/testsuite/gcc.dg/lto/20110201-1_0.c   (revision 177409)
> --- gcc/testsuite/gcc.dg/lto/20110201-1_0.c   (working copy)
> *************** foo (_Complex double x, int b)
> *** 16,19 ****
> --- 16,29 ----
>       x = 0;
>     return cabs(x);
>   }
> + 
> + /* We provide a dummy sqrt to avoid link failures on targets that do not
> +    expand sqrt inline.  Note that we do not link against libm in order
> +    to ensure cabs is not satisfied by the library, but must be folded.  */
> + double __attribute__((used))
> + sqrt (double x)
> + {
> +   return x;
> + }
> + 
>   int main() { return 0; }
> 
> 
> 

-- 
Richard Guenther <rguent...@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer

Reply via email to