GMP test fails with -flto

Marc Glisse marc.glisse at inria.fr
Tue Jul 2 19:05:52 UTC 2019


On Tue, 2 Jul 2019, Torbjörn Granlund wrote:

> The main funcion is needed as we create an executable, its references to
> foo are needed, else LTO will remove foo altogether.
>
> *** /tmp/extdiff.MsIr0g/gmp-main.3300fbb5d615/acinclude.m4	Mon Jun 17 00:11:50 2019
> --- /home/tege/prec/gmp-main/acinclude.m4	Tue Jul  2 12:37:53 2019
> ***************
> *** 3307,3313 ****
>    -123456789.0,
>    { '\376', '\334', '\272', '\230', '\166', '\124', '\062', '\020' },
> ! };]
>  EOF
> ! gmp_compile="$CC $CFLAGS $CPPFLAGS -c conftest.c >&AC_FD_CC 2>&1"
>  if AC_TRY_EVAL(gmp_compile); then
>  cat >conftest.awk <<\EOF
> --- 3307,3320 ----
>    -123456789.0,
>    { '\376', '\334', '\272', '\230', '\166', '\124', '\062', '\020' },
> ! };
> ! int main(){
> !   int i;
> !   for (i = 0; i < 8; i++) {
> !     printf ("%d %d %f\n", foo.before[i] + foo.after[i], foo.x);

Without #include <stdio.h>, some compilers reject it. Also, the string 
should be "%d %f" (or replace '+' with ',' in the arguments).

I think it still fails for emscripten (little endian detected as unknown), 
but that shouldn't block the patch, which helps for gcc/clang LTO, and 
emscripten probably has several other issues anyway.

-- 
Marc Glisse


More information about the gmp-bugs mailing list